clockworklabs/SpacetimeDB · error
Cannot use generate-entry-specific arguments ({}) when gener
Error message
Cannot use generate-entry-specific arguments ({}) when generating for multiple entries. Specify a database name to select a single target, or remove these arguments. What it means
The generate command's counterpart of the module-arg guard: when generating for multiple entries (entry_count > 1), CLI flags flagged generate_entry_specific are rejected because they could only apply to one entry. The message offers the two escapes: select a single entry by database name, or drop the flags and configure the entries in the config file.
Source
Thrown at crates/cli/src/spacetime_config.rs:549
}
/// Validate that generate-entry-specific CLI flags are not used when operating on multiple generate entries.
pub fn validate_no_generate_entry_specific_cli_args(
&self,
command: &Command,
matches: &ArgMatches,
entry_count: usize,
) -> anyhow::Result<()> {
if entry_count <= 1 {
return Ok(());
}
let display_args = self.generate_entry_specific_cli_flags(command, matches);
if display_args.is_empty() {
return Ok(());
}
anyhow::bail!(
"Cannot use generate-entry-specific arguments ({}) when generating for multiple entries. \
Specify a database name to select a single target, or remove these arguments.",
display_args.join(", "),
);
}
/// Get the clap argument name for a config key.
pub fn clap_arg_name_for<'a>(&'a self, config_name: &'a str) -> &'a str {
self.config_to_clap
.get(config_name)
.map(|s| s.as_str())
.unwrap_or(config_name)
}
}
/// Configuration for a single key in the CommandConfig.
#[derive(Debug, Clone)]
pub struct Key {View on GitHub (pinned to 524b4487d9)
Solutions
- Pass the database name to generate for exactly one entry
- Drop the entry-specific flags for multi-entry generation
- Encode per-entry options in the spacetime.json generate entries so the CLI stays generic
Example fix
# before (multiple generate entries in config) spacetime generate --out-dir src/generated # after spacetime generate --database mydb --out-dir src/generated
Defensive patterns
Strategy: validation
Validate before calling
# In codegen scripts, require a database selector once the config has multiple entries
ENTRY_COUNT=$(jq '[.databases[]? | select(.generate)] | length // (.generate_entries // [] | length)' spacetime.json 2>/dev/null || echo 0)
if [ "$ENTRY_COUNT" -gt 1 ] && [ -z "$DB" ]; then
echo 'pass --database when generating for multiple entries' >&2; exit 2
fi
spacetime generate ${DB:+--database "$DB"} Try / catch
if ! spacetime generate $FLAGS; then # if stderr contains 'generate-entry-specific arguments', retry without entry flags or with --database spacetime generate --database "$DB" fi
Prevention
- Treat `spacetime generate` as per-entry: always pass --database in projects with more than one generate entry
- Keep entry-specific output options inside each spacetime.json generate entry instead of on the command line
When it happens
Trigger: `spacetime generate` in a project whose config declares multiple generate entries, while passing entry-specific CLI options (collected via generate_entry_specific_cli_flags), without a --database selector.
Common situations: Adding a second client/database to a project and reusing the previous generate invocation; CI codegen steps that pinned output options per entry via flags.
Related errors
- Cannot use module-specific arguments ({}) when {}. {}
- the following required arguments were not provided: <{}>
- the following required arguments were not provided: <datab
- Invalid describe arguments. Usage: spacetime describe [datab
- `--module-path`, `--project-path`, and `--module-bindings-pa
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/99b0c0657598a71a.
Report an issue: GitHub.