{"record":{"id":"3e5fe493e10dff7a","repo":"PRQL/prql","slug":"currently-annotate-only-works-with-a-single-sour","errorCode":null,"errorMessage":"Currently `annotate` only works with a single source, but found multiple sources: {:?}","messagePattern":"Currently `annotate` only works with a single source, but found multiple sources: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/cli/mod.rs","lineNumber":431,"sourceCode":"                    // TODO: allow multiple sources\n                    bail!(\"Currently `lex` only works with a single source, but found multiple sources\")\n                })?;\n                let tokens = prql_to_tokens(s)?;\n                match format {\n                    Format::Json => serde_json::to_string_pretty(&tokens)?.into_bytes(),\n                    Format::Yaml => serde_yaml::to_string(&tokens)?.into_bytes(),\n                }\n            }\n            Command::Collect(_) => {\n                let mut root_module_def = prql_to_pl_tree(sources)?;\n\n                drop_module_def(&mut root_module_def.stmts, \"std\");\n\n                pl_to_prql(&root_module_def)?.into_bytes()\n            }\n            Command::Debug(DebugCommand::Annotate(_)) => {\n                let (_, source) = sources.sources.clone().into_iter().exactly_one().or_else(\n                    |_| bail!(\n                        \"Currently `annotate` only works with a single source, but found multiple sources: {:?}\",\n                        sources.sources.keys()\n                            .map(|x| x.display().to_string())\n                            .sorted()\n                            .map(|x| format!(\"`{x}`\"))\n                            .join(\", \")\n                    )\n                )?;\n\n                // TODO: potentially if there is code performing a role beyond\n                // presentation, it should be a library function; and we could\n                // promote it to the `prqlc` crate.\n                let root_mod = prql_to_pl(&source)?;\n\n                // resolve\n                let ctx = semantic::resolve(root_mod)?;\n\n                let frames = if let Ok((main, _)) = ctx.find_main_rel(&[]) {","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/cli/mod.rs#L413-L449","documentation":"The hidden `prqlc debug annotate` command annotates a single PRQL source, so like `lex` it requires exactly one input. If multiple sources are present, it bails listing all source names back-quoted, to show which files conflicted.","triggerScenarios":"Running `prqlc debug annotate` with a project or file set that resolves to more than one source (multiple files, main + includes).","commonSituations":"Exploring compiler annotations on a multi-file project; accidentally passing a directory instead of a single file.","solutions":["Invoke annotate with a single standalone .prql file","Temporarily inline included modules into one file before annotating","Read the listed source names in the message and remove all but the intended one from the input set"],"exampleFix":"# before\nprqlc debug annotate project/ --include project/helpers.prql\n# after\nprqlc debug annotate project/main.prql","handlingStrategy":"validation","validationCode":"# Single-file check for debug annotate\n[ -f \"$1\" ] && [ \"$(find \"$1\" -name '*.prql' | wc -l)\" -le 1 ] && prqlc debug annotate \"$1\"","typeGuard":null,"tryCatchPattern":"prqlc debug annotate main.prql 2>&1 | grep -v 'single source' || true","preventionTips":["Annotate one standalone file at a time","Inline includes into one file when whole-project annotation is needed","Read the listed source names in the error to identify extra inputs"],"tags":["cli","prql","debug"],"backgroundTag":"unsupported-operation","analyzedSha":"e164e249b99485890036eb60f57c37520379b240","analyzedAt":"2026-09-09T12:18:38.727Z","contentChangedAt":"2026-09-09T12:18:38.727Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}