{"record":{"id":"99b0c0657598a71a","repo":"clockworklabs/SpacetimeDB","slug":"cannot-use-generate-entry-specific-arguments","errorCode":null,"errorMessage":"Cannot use generate-entry-specific arguments ({}) when generating for multiple entries. Specify a database name to select a single target, or remove these arguments.","messagePattern":"Cannot use generate-entry-specific arguments \\((.+?)\\) when generating for multiple entries\\. Specify a database name to select a single target, or remove these arguments\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/spacetime_config.rs","lineNumber":579,"sourceCode":"    }\n\n    /// Validate that generate-entry-specific CLI flags are not used when operating on multiple generate entries.\n    pub fn validate_no_generate_entry_specific_cli_args(\n        &self,\n        command: &Command,\n        matches: &ArgMatches,\n        entry_count: usize,\n    ) -> anyhow::Result<()> {\n        if entry_count <= 1 {\n            return Ok(());\n        }\n\n        let display_args = self.generate_entry_specific_cli_flags(command, matches);\n        if display_args.is_empty() {\n            return Ok(());\n        }\n\n        anyhow::bail!(\n            \"Cannot use generate-entry-specific arguments ({}) when generating for multiple entries. \\\n             Specify a database name to select a single target, or remove these arguments.\",\n            display_args.join(\", \"),\n        );\n    }\n\n    /// Get the clap argument name for a config key.\n    pub fn clap_arg_name_for<'a>(&'a self, config_name: &'a str) -> &'a str {\n        self.config_to_clap\n            .get(config_name)\n            .map(|s| s.as_str())\n            .unwrap_or(config_name)\n    }\n}\n\n/// Configuration for a single key in the CommandConfig.\n#[derive(Debug, Clone)]\npub struct Key {","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/cli/src/spacetime_config.rs#L561-L597","documentation":"The generate-flavored multi-target guard: when spacetime.json declares multiple generate entries, CLI arguments marked generate-entry-specific are rejected because they cannot be applied to every entry. The message tells you to select a single entry via a database name or drop the arguments.","triggerScenarios":"Running `spacetime generate` with entry_count > 1 (multiple generate entries in config) while any generate-entry-specific CLI argument is present.","commonSituations":"Generating bindings for several languages or modules at once while passing per-entry options (output settings and the like) on the command line.","solutions":["Pass the database name to select a single generate entry","Remove the entry-specific CLI arguments for multi-entry runs","Encode the per-entry options inside each generate entry in spacetime.json"],"exampleFix":"# before\nspacetime generate --<entry-specific-arg> value\n# with multiple generate entries in spacetime.json\n\n# after\nspacetime generate --database my-db --<entry-specific-arg> value","handlingStrategy":"validation","validationCode":"// with multiple generate entries, require an explicit single target\nif generate_entries.len() > 1 && database_name.is_none() {\n    assert!(entry_specific_args.is_empty(), \"pass --database or drop entry-specific args\");\n}","typeGuard":null,"tryCatchPattern":"Catch the 'Cannot use generate-entry-specific arguments' bail, surface the hint (select one entry via database name), and re-run with a single target.","preventionTips":["Put per-entry generate options in spacetime.json entries","Default generate scripts to an explicit --database when entries > 1"],"tags":["cli","generate","multi-target","bindings","spacetime-json"],"backgroundTag":"ambiguous-cli-target","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}