clockworklabs/SpacetimeDB · error · anyhow::Error
Too many positional arguments for interactive mode. Usage: s
Error message
Too many positional arguments for interactive mode. Usage: spacetime sql [database] --interactive [--no-config]
What it means
In `spacetime sql --interactive`, the CLI first collects all positional `sql_parts`. Interactive mode only accepts at most one positional (the database name); the REPL supplies the queries. If more than one positional was passed, it bails with this usage message before resolving the database or opening the REPL.
Source
Thrown at crates/cli/src/subcommands/sql.rs:231
)?;
Ok((stats, table))
}
pub async fn exec(config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {
eprintln!("{UNSTABLE_WARNING}\n");
let interactive = args.get_one::<bool>("interactive").unwrap_or(&false);
let no_config = args.get_flag("no_config");
let format = *args.get_one::<Format>("format").unwrap();
let raw_parts: Vec<String> = args
.get_many::<String>("sql_parts")
.map(|vals| vals.cloned().collect())
.unwrap_or_default();
let config_targets = load_config_db_targets(no_config)?;
if *interactive {
if raw_parts.len() > 1 {
anyhow::bail!(
"Too many positional arguments for interactive mode.\nUsage: spacetime sql [database] --interactive [--no-config]"
);
}
let resolved = resolve_database_arg(
raw_parts.first().map(|s| s.as_str()),
config_targets.as_deref(),
"spacetime sql [database] --interactive [--no-config]",
)?;
let con = parse_req(config, args, &resolved.database, resolved.server.as_deref()).await?;
crate::repl::exec(con, format).await?;
} else {
let resolved = resolve_optional_database_parts(
&raw_parts,
config_targets.as_deref(),
"query",
"spacetime sql [database] <query> [--no-config]",
)View on GitHub (pinned to 524b4487d9)
Solutions
- Drop the query argument: `spacetime sql mydb --interactive`, then type SQL in the REPL
- Pass at most one positional (the database); put everything else in the REPL
- For one-shot queries, remove `--interactive` entirely and keep the quoted SQL argument
Example fix
# before spacetime sql mydb "SELECT 1" --interactive # after spacetime sql mydb --interactive -- then: SELECT 1; inside the REPL
Defensive patterns
Strategy: validation
Validate before calling
# Reject multi-positional invocations before running
[ $# -le 2 ] || { echo 'interactive sql takes at most one positional (database)'; exit 2; } Prevention
- In interactive mode pass only the database; type SQL inside the REPL
- Drop `--interactive` for one-shot queries and keep the quoted SQL argument
When it happens
Trigger: Running e.g. `spacetime sql mydb "SELECT * FROM t" --interactive` — two positionals — or pasting a full query plus a database name while the interactive flag is set.
Common situations: Copy-pasting a one-shot sql command and appending `--interactive` without dropping the query argument; shell scripts concatenating arguments; misunderstanding that in interactive mode all SQL is typed inside the REPL.
Related errors
- Cannot semijoin a table to itself
- Cannot continue without a module path.
- Multiple databases found in config: {}. Please specify which
- Estimated cardinality ({estimate} rows) exceeds limit ({limi
- no such module
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/ab9309fea7dc1cf4.
Report an issue: GitHub.