# Message

> Defines CSV export exception message templates.

[API reference](/docs/api/index.md) › [CSV Export](/docs/extensions/csv-export/reference/index.md) › [exception](/docs/extensions/csv-export/reference/exception/index.md) › Message

| enum | `yii2\extensions\csvexport\exception\Message` |
| --- | --- |
| Backed by | `string` |
| Source | [`src/exception/Message.php`](https://github.com/yii2-extensions/csv-export/blob/main/src/exception/Message.php#L14) |

Defines CSV export exception message templates.

Use [`Message::getMessage()`](/docs/extensions/csv-export/reference/exception/message/index.md#method-getMessage) to format the template with `sprintf()` arguments.

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-ARCHIVER_RESULT_INVALID"></span>`ARCHIVER_RESULT_INVALID` | `'The archiver must return a readable file in the private export directory.'` | Error when the archiver returns a source CSV or a path that is not a readable file in the export directory. |
| <span id="case-COLUMN_CLASS_INVALID"></span>`COLUMN_CLASS_INVALID` | `'Every configured export column must extend Column.'` | Error when a configured export column does not extend the base column class. |
| <span id="case-COLUMN_EXPORTER_NOT_ASSIGNED"></span>`COLUMN_EXPORTER_NOT_ASSIGNED` | `'Assign the column to an exporter before rendering.'` | Error when a column is rendered before it is assigned to an exporter. |
| <span id="case-COLUMN_FORMAT_INVALID"></span>`COLUMN_FORMAT_INVALID` | `'The column must be specified in the format of "attribute", "attribute:format" ' . 'or "attribute:format:label"'` | Error when a column shortcut does not match the `attribute:format:label` format. |
| <span id="case-COLUMN_ROW_INVALID"></span>`COLUMN_ROW_INVALID` | `'Reading a column attribute requires an array or object row.'` | Error when a column attribute is read from a row that is neither an array nor an object. |
| <span id="case-CSV_BOM_ENCODING_MISMATCH"></span>`CSV_BOM_ENCODING_MISMATCH` | `'The BOM must match the CSV output encoding.'` | Error when the configured BOM does not match the CSV output encoding. |
| <span id="case-CSV_CELL_INVALID"></span>`CSV_CELL_INVALID` | `'CSV cells must be scalar, null or stringable.'` | Error when a CSV cell value is neither scalar, `null` nor stringable. |
| <span id="case-CSV_DIALECT_INVALID"></span>`CSV_DIALECT_INVALID` | `'Use distinct single-byte CSV delimiters and an LF, CR or CRLF line ending.'` | Error when the CSV delimiters or the line ending are invalid. |
| <span id="case-CSV_ENCODING_UNSUPPORTED"></span>`CSV_ENCODING_UNSUPPORTED` | `'Choose UTF-8, UTF-16LE or UTF-16BE for CSV output.'` | Error when the CSV output encoding is not supported. |
| <span id="case-CSV_FINALIZE_FAILED"></span>`CSV_FINALIZE_FAILED` | `'Unable to finalize CSV "%s".'` | Error when the CSV stream cannot be flushed or released. |
| <span id="case-CSV_NOT_OPEN"></span>`CSV_NOT_OPEN` | `'Open the CSV before writing.'` | Error when content is written before the CSV stream is opened. |
| <span id="case-CSV_NOT_WRITABLE"></span>`CSV_NOT_WRITABLE` | `'The CSV is no longer writable.'` | Error when a closed or failed CSV is written to. |
| <span id="case-CSV_OPEN_FAILED"></span>`CSV_OPEN_FAILED` | `'Unable to open CSV "%s".'` | Error when the CSV stream cannot be opened. |
| <span id="case-CSV_SPREADSHEET_SAFE_REQUIRES_UTF8"></span>`CSV_SPREADSHEET_SAFE_REQUIRES_UTF8` | `'Spreadsheet-safe CSV requires UTF-8 text.'` | Error when spreadsheet-safe escaping receives text that is not valid UTF-8. |
| <span id="case-CSV_TRANSCODING_REQUIRES_UTF8"></span>`CSV_TRANSCODING_REQUIRES_UTF8` | `'Transcoding requires UTF-8 input.'` | Error when transcoding receives content that is not valid UTF-8. |
| <span id="case-CSV_UNQUOTED_CELL_INVALID"></span>`CSV_UNQUOTED_CELL_INVALID` | `'An unquoted cell cannot contain a delimiter or line break.'` | Error when an unquoted CSV cell contains a delimiter or a line break. |
| <span id="case-CSV_WRITE_INCOMPLETE"></span>`CSV_WRITE_INCOMPLETE` | `'Unable to complete write to CSV "%s".'` | Error when the CSV stream stops accepting bytes before the content is written. |
| <span id="case-DATA_PROVIDER_KEYS_MISMATCH"></span>`DATA_PROVIDER_KEYS_MISMATCH` | `'The data provider must return one key for each model.'` | Error when the data provider returns a different number of keys and models. |
| <span id="case-DATA_SOURCE_NOT_CONFIGURED"></span>`DATA_SOURCE_NOT_CONFIGURED` | `'Configure a data provider or a query before exporting.'` | Error when neither a data provider nor a query is configured. |
| <span id="case-DOWNLOAD_NAME_INVALID"></span>`DOWNLOAD_NAME_INVALID` | `'Use a download name without path separators or control characters.'` | Error when the download name is empty or contains path separators or control characters. |
| <span id="case-EXPORT_BASE_NAME_INVALID"></span>`EXPORT_BASE_NAME_INVALID` | `'Use a simple file base name for the export.'` | Error when the export file base name is not a simple file name. |
| <span id="case-EXPORT_CSV_INVALID"></span>`EXPORT_CSV_INVALID` | `'The export contains a missing, incomplete or unowned CSV.'` | Error when the export contains a CSV that is missing, incomplete or outside the private export directory. |
| <span id="case-EXPORT_DESTINATION_INSIDE_WORKSPACE"></span>`EXPORT_DESTINATION_INSIDE_WORKSPACE` | `'Deliver the export outside its private workspace.'` | Error when the delivery destination is inside the private export directory. |
| <span id="case-EXPORT_DESTINATION_PREPARE_FAILED"></span>`EXPORT_DESTINATION_PREPARE_FAILED` | `'Unable to prepare the destination for the export.'` | Error when the delivery destination directory cannot be prepared. |
| <span id="case-EXPORT_DIRECTORY_ALREADY_ALLOCATED"></span>`EXPORT_DIRECTORY_ALREADY_ALLOCATED` | `'The private export directory is already allocated.'` | Error when the parent directory is set after the private export directory is allocated. |
| <span id="case-EXPORT_DIRECTORY_CREATE_FAILED"></span>`EXPORT_DIRECTORY_CREATE_FAILED` | `'Unable to create a private export directory.'` | Error when the private export directory cannot be created. |
| <span id="case-EXPORT_DIRECTORY_IDENTIFY_FAILED"></span>`EXPORT_DIRECTORY_IDENTIFY_FAILED` | `'Unable to identify the private export directory.'` | Error when the identity of the private export directory cannot be read. |
| <span id="case-EXPORT_DIRECTORY_REMOVE_FAILED"></span>`EXPORT_DIRECTORY_REMOVE_FAILED` | `'Unable to remove the private export directory.'` | Error when the private export directory remains after cleanup. |
| <span id="case-EXPORT_LEASE_CREATE_FAILED"></span>`EXPORT_LEASE_CREATE_FAILED` | `'Unable to create the export lease.'` | Error when the export lease file cannot be created. |
| <span id="case-EXPORT_PARENT_DIRECTORY_READ_FAILED"></span>`EXPORT_PARENT_DIRECTORY_READ_FAILED` | `'Unable to read the export parent directory.'` | Error when the export parent directory cannot be listed. |
| <span id="case-EXPORT_RETENTION_NOT_POSITIVE"></span>`EXPORT_RETENTION_NOT_POSITIVE` | `'Export retention must be positive.'` | Error when the export retention age is not positive. |
| <span id="case-EXPORT_STAGE_FAILED"></span>`EXPORT_STAGE_FAILED` | `'Unable to stage the export.'` | Error when the staging file for the export cannot be created. |
| <span id="case-EXPORT_STAGE_OUTSIDE_DESTINATION"></span>`EXPORT_STAGE_OUTSIDE_DESTINATION` | `'Unable to stage the export beside its destination.'` | Error when the staging file is created outside the destination directory. |
| <span id="case-EXPORT_WORKSPACE_LOCK_FAILED"></span>`EXPORT_WORKSPACE_LOCK_FAILED` | `'Unable to lock the export workspace.'` | Error when the export workspace cannot be locked. |
| <span id="case-EXPORT_WORKSPACE_PREPARE_FAILED"></span>`EXPORT_WORKSPACE_PREPARE_FAILED` | `'Unable to prepare the export workspace.'` | Error when the export base directory cannot be created or resolved. |
| <span id="case-FILE_ROW_LIMIT_TOO_SMALL"></span>`FILE_ROW_LIMIT_TOO_SMALL` | `'The file limit must fit the header, footer and at least one data row.'` | Error when the per-file row limit cannot fit the header, footer and one data row. |
| <span id="case-FORMATTER_NOT_CONFIGURED"></span>`FORMATTER_NOT_CONFIGURED` | `'Configure a Yii formatter before exporting formatted data.'` | Error when formatted data is exported without a Yii application formatter. |
| <span id="case-INFERRED_COLUMN_NAME_INVALID"></span>`INFERRED_COLUMN_NAME_INVALID` | `'Inferred column names must be strings or integers.'` | Error when an inferred column name is neither a string nor an integer. |
| <span id="case-PAGINATION_NOT_CLONED"></span>`PAGINATION_NOT_CLONED` | `'A custom data provider must clone its pagination for export.'` | Error when a custom data provider returns its own pagination instead of a clone. |
| <span id="case-QUERY_BATCH_ROWS_NOT_ITERABLE"></span>`QUERY_BATCH_ROWS_NOT_ITERABLE` | `'Each query batch must contain iterable rows.'` | Error when a query batch is not iterable. |
| <span id="case-QUERY_BATCH_SIZE_NOT_POSITIVE"></span>`QUERY_BATCH_SIZE_NOT_POSITIVE` | `'The query batch size must be positive.'` | Error when the query batch size is not positive. |
| <span id="case-QUERY_BATCHES_NOT_ITERABLE"></span>`QUERY_BATCHES_NOT_ITERABLE` | `'The query must return iterable batches.'` | Error when the query batch method does not return an iterable. |
| <span id="case-RESULT_CLASS_INVALID"></span>`RESULT_CLASS_INVALID` | `'The configured result must extend ExportResult.'` | Error when the configured result class does not extend the export result class. |
| <span id="case-SEND_REQUIRES_WEB_RESPONSE"></span>`SEND_REQUIRES_WEB_RESPONSE` | `'Sending a CSV requires a Yii web response.'` | Error when a completed export is sent without a Yii web application. |
| <span id="case-SEND_RESULT_MISSING"></span>`SEND_RESULT_MISSING` | `'There is no completed export to send.'` | Error when there is no completed export to send. |
| <span id="case-WRITER_CLASS_INVALID"></span>`WRITER_CLASS_INVALID` | `'The configured writer must extend CsvFile.'` | Error when the configured writer class does not extend the CSV writer class. |
| <span id="case-ZIP_ADD_MEMBER_FAILED"></span>`ZIP_ADD_MEMBER_FAILED` | `'Unable to add a member to the export ZIP.'` | Error when a member cannot be added to the export ZIP. |
| <span id="case-ZIP_EXTENSION_MISSING"></span>`ZIP_EXTENSION_MISSING` | `'Install ext-zip or configure an export archiver.'` | Error when neither ext-zip nor a custom export archiver is available. |
| <span id="case-ZIP_FINALIZE_FAILED"></span>`ZIP_FINALIZE_FAILED` | `'Unable to finalize the export ZIP.'` | Error when the export ZIP cannot be closed. |
| <span id="case-ZIP_OPEN_FAILED"></span>`ZIP_OPEN_FAILED` | `'Unable to open the export ZIP.'` | Error when the export ZIP cannot be opened. |
| <span id="case-ZIP_PUBLISH_FAILED"></span>`ZIP_PUBLISH_FAILED` | `'Unable to publish the completed export ZIP.'` | Error when the staged export ZIP cannot be moved to its final path. |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getMessage()`](#method-getMessage) | Returns the formatted message string for the error case. | `Message` |

## Method details

### getMessage() <span id="method-getMessage"></span>

```php
public function getMessage(int|string ...$argument): string
```

Returns the formatted message string for the error case.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `...$argument` | `int\|string` | Values to insert into the message template. |

**Returns**

`string`