{"record":{"id":"68999b8cfd56230e","repo":"PRQL/prql","slug":"expected-a-value-found-a-type","errorCode":null,"errorMessage":"expected a value, found a type","messagePattern":"expected a value, found a type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/semantic/resolver/expr.rs","lineNumber":155,"sourceCode":"                            }\n                        }\n                        _ => self.fold_expr(expr.as_ref().clone())?,\n                    },\n\n                    DeclKind::InstanceOf(_, ty) => {\n                        let ty = ty.clone();\n\n                        let fields = self.construct_wildcard_include(&fq_ident);\n\n                        pl::Expr {\n                            kind: pl::ExprKind::Tuple(fields),\n                            ty,\n                            ..node\n                        }\n                    }\n\n                    DeclKind::Ty(_) => {\n                        return Err(Error::new(Reason::Expected {\n                            who: None,\n                            expected: \"a value\".to_string(),\n                            found: \"a type\".to_string(),\n                        })\n                        .with_span(span));\n                    }\n\n                    _ => pl::Expr {\n                        kind: pl::ExprKind::Ident(fq_ident),\n                        ..node\n                    },\n                }\n            }\n\n            // special case: handle the syntax !{tuple..} via resolve_column_exclusion\n            pl::ExprKind::FuncCall(pl::FuncCall {\n                name,\n                args,","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/semantic/resolver/expr.rs#L137-L173","documentation":"The resolver distinguishes types from values. When an expression resolves to a declaration whose kind is `DeclKind::Ty` (a type), but a value is required in that position, this error is thrown. Types are not first-class values in PRQL.","triggerScenarios":"Using a type name as a value, e.g. `select int` or `derive x = date`, outside of a type-annotation context (the `who` slot of a func param or `typeof`).","commonSituations":"Accidentally selecting a column named like a type, or confusing type annotations (after `:`) with value expressions.","solutions":["Remove the type name from value position or replace it with an actual expression/value","If a cast/conversion was intended, use the appropriate function (e.g. `std.int` cast via `+ : int` annotation on params or conversion functions)","Check for shadowing: a column sharing a name with a type"],"exampleFix":"// before\nselect int\n// after\nselect x | cast int  # or annotate types only on function params","handlingStrategy":"type-guard","validationCode":"// Do not use type keywords in value positions\nconst TYPE_NAMES = [\"int\",\"float\",\"bool\",\"text\",\"date\",\"timestamp\"];\nif (TYPE_NAMES.includes(selectedColumn)) {\n  throw new Error(`${selectedColumn} is a type, not a value; check for shadowing`);\n}","typeGuard":"function isTypeReference(node, types) {\n  return node.kind === \"ident\" && types.has(node.name);\n}","tryCatchPattern":"try {\n  compile(query);\n} catch (e) {\n  if (e.message.includes(\"expected a value, found a type\")) {\n    console.error(\"Types only belong in `:` annotations, not value expressions.\");\n  } else { throw e; }\n}","preventionTips":["Only use types after `:` in function params or casts","Rename columns that shadow type names","Use cast functions for conversions rather than bare type names"],"tags":["prql","resolver","type-vs-value"],"backgroundTag":"type-mismatch","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"}