If you’re getting an error that reads “mode should be one of: ascii box column …etc” in DuckDB, it appears that you’re trying to set the output mode to an invalid value.
While we can change the output mode in DuckDB, it must be one of the supported modes.
To fix this issue, be sure to use a supported mode.
Example of Error
Here’s an example of code that produces the error:
.mode default
Output:
Error: mode should be one of: ascii box column csv duckbox html insert json jsonlines latex line list markdown quote table tabs tcl trash
Here I tried to change the output mode to default
, but DuckDB doesn’t support that value.
Solution
To fix this issue, use one of the output modes that DuckDB supports. Fortunately the error message shows us which values are supported, so we can use one of those.
Example:
.mode duckbox
In this case, no error was returned. That’s because I changed the mode to a supported mode, in this case duckbox
, which is DuckDB’s default mode.
Get a List of Supported Modes
You can use the following command to get a list of supported modes:
.help mode
Output:
.mode MODE ?TABLE? Set output mode
MODE is one of:
ascii Columns/rows delimited by 0x1F and 0x1E
box Tables using unicode box-drawing characters
csv Comma-separated values
column Output in columns. (See .width)
duckbox Tables with extensive features
html HTML <table> code
insert SQL insert statements for TABLE
json Results in a JSON array
jsonlines Results in a NDJSON
latex LaTeX tabular environment code
line One value per line
list Values delimited by "|"
markdown Markdown table format
quote Escape answers as for SQL
table ASCII-art table
tabs Tab-separated values
tcl TCL list elements
trash No output
This shows us the syntax, followed by the supported modes.