{"record":{"id":"ebee0eb66f75a4c2","repo":"PRQL/prql","slug":"name-not-found-in-namespace-target-name-s","errorCode":null,"errorMessage":"{name} not found in namespace `target` (name: {s:?})","messagePattern":"(.+?) not found in namespace `target` \\(name: (.+?)\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/lib.rs","lineNumber":256,"sourceCode":"        names\n    }\n}\n\nimpl FromStr for Target {\n    type Err = Error;\n\n    fn from_str(s: &str) -> Result<Target, Self::Err> {\n        if let Some(dialect) = s.strip_prefix(\"sql.\") {\n            if dialect == \"any\" {\n                return Ok(Target::Sql(None));\n            }\n\n            if let Ok(dialect) = sql::Dialect::from_str(dialect) {\n                return Ok(Target::Sql(Some(dialect)));\n            }\n        }\n\n        Err(Error::new(Reason::NotFound {\n            name: format!(\"{s:?}\"),\n            namespace: \"target\".to_string(),\n        }))\n    }\n}\n\n/// Compilation options for SQL backend of the compiler.\n#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct Options {\n    /// Pass generated SQL string through a formatter that splits it\n    /// into multiple lines and prettifies indentation and spacing.\n    ///\n    /// Defaults to true.\n    pub format: bool,\n\n    /// Target and dialect to compile to.\n    pub target: Target,\n","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/lib.rs#L238-L274","documentation":"`Target::from_str` parses a compile-target string (the `target` namespace value). If the string isn't a known SQL dialect name, it raises `Reason::NotFound` with the value and namespace. Targets come from CLI flags, query annotations like `prql target:sql.sqlite`, or config files.","triggerScenarios":"Setting an unknown target string, e.g. `prql target:sql.postgres13`, `--target sql.mysql8`, or an env/config value that isn't a valid `Dialect` per sqlparser's `Dialect::from_str`.","commonSituations":"Typos in dialect names (`postgres` vs `postgres`? e.g. `sql.psql`), inventing dialect versions not supported by the underlying sqlparser, stale docs referencing removed dialect names.","solutions":["Use a supported value like `sql.sqlite`, `sql.postgres`, `sql.mysql`, `sql.duckdb`, `sql.mssql`, `sql.bigquery`, `sql.clickhouse`, `sql.ansi`","Check `prqlc compile --help` / docs for the exact accepted target list","Correct the target line in the .prql file or the CLI/env config"],"exampleFix":"// before\nprql target:sql.psql\n// after\nprql target:sql.postgres","handlingStrategy":"validation","validationCode":"const VALID_TARGETS = ['sql.ansi','sql.bigquery','sql.clickhouse','sql.duckdb','sql.generic','sql.mssql','sql.mysql','sql.postgres','sql.sqlite']; const ok = (t: string) => VALID_TARGETS.includes(t);","typeGuard":"function isKnownTarget(t: string): boolean { return VALID_TARGETS.includes(t); }","tryCatchPattern":"try { compile(prql, { target }) } catch (e) { if (String(e).includes(\"not found in namespace `target`\")) { target = 'sql.generic'; } else { throw e } }","preventionTips":["Copy target strings from the official dialect list, never from memory","Keep the target in one reviewed config location","Test the target against a real query in CI before switching environments"],"tags":["target","dialect","config","validation"],"backgroundTag":"invalid-enum-value","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"}