PRQL/prql · error

Currently `highlight` only works with a single source, but…

Error message

Currently `highlight` only works with a single source, but found multiple sources

What it means

The experimental `prqlc highlight` command tokenizes one PRQL source to emit syntax highlighting. Like lex and annotate, it demands exactly one source and bails when several are supplied (the TODO notes multi-source support is planned).

Solutions

  1. Highlight one file at a time: prqlc highlight <single-file>.prql
  2. Drop --include flags; merge into one file if a combined view is needed
  3. If integrating with an editor, feed only the active buffer's contents via stdin

Example fix

# before
prqlc highlight main.prql helpers.prql
# after
prqlc highlight main.prql
Defensive patterns

Strategy: validation

Validate before calling

# Only one source for highlight
prqlc highlight main.prql  # no extra args, no --include

Try / catch

prqlc highlight "$file" || echo "highlight failed for $file; run per file"

Prevention

When it happens

Trigger: Running `prqlc experimental highlight` (or highlight) with multiple input files or includes so sources.sources has more than one entry.

Common situations: Editor integrations piping a project rather than the open buffer; scripts passing includes along with the main file for colorized output.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of PRQL/prql@e164e249b9 (2026-09-09). Data as JSON: /api/errors/382cec9b55e5c280. Report an issue: GitHub.

Appendix: source

Thrown at prqlc/prqlc/src/cli/mod.rs:483

                    Format::Yaml => serde_yaml::to_string(&fc)?.into_bytes(),
                }
            }
            Command::Experimental(ExperimentalCommand::GenerateDocs { format, .. }) => {
                let module_ref = prql_to_pl_tree(sources)?;

                match format {
                    DocsFormat::Html => {
                        docs_generator::generate_html_docs(module_ref.stmts).into_bytes()
                    }
                    DocsFormat::Markdown => {
                        docs_generator::generate_markdown_docs(module_ref.stmts).into_bytes()
                    }
                }
            }
            Command::Experimental(ExperimentalCommand::Highlight(_)) => {
                let s = sources.sources.values().exactly_one().or_else(|_| {
                    // TODO: allow multiple sources
                    bail!("Currently `highlight` only works with a single source, but found multiple sources")
                })?;
                let tokens = prql_to_tokens(s)?;

                maybe_strip_colors(&highlight::highlight(&tokens)).into_bytes()
            }
            Command::Compile {
                signature_comment,
                format,
                target,
                debug_log,
                ..
            } => {
                if debug_log.is_some() {
                    debug::log_start();
                }

                let opts = Options::default()
                    .with_target(Target::from_str(target).map_err(prqlc::ErrorMessages::from)?)

View on GitHub (pinned to e164e249b9)