{"record":{"id":"f7bd808a9ee4e5c2","repo":"dbt-labs/dbt-core","slug":"type-does-not-define-keys","errorCode":null,"errorMessage":"{} type does not define keys()","messagePattern":"(.+?) type does not define keys\\(\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-agate/src/lib.rs","lineNumber":714,"sourceCode":"                assert_nullary_args!(\"MappedSequence.values\", args)?;\n                let values = self.values();\n                Ok(Value::from_object(values))\n            }\n            \"keys\" => {\n                assert_nullary_args!(\"MappedSequence.keys\", args)?;\n                let keys = self\n                    .keys()\n                    .map(Value::from_object)\n                    .unwrap_or_else(|| Value::from(()));\n                Ok(keys)\n            }\n            \"items\" => {\n                assert_nullary_args!(\"MappedSequence.items\", args)?;\n                if let Some(items) = self.items() {\n                    Ok(Value::from_object(items))\n                } else {\n                    // trying to approximate a `raise KeyError`\n                    Err(minijinja::Error::new(\n                        ErrorKind::NonKey,\n                        format!(\"{} type does not define keys()\", self.type_name()),\n                    ))\n                }\n            }\n            \"get\" => {\n                // def get(self, key, default=None)\n                let iter = ArgsIter::new(\"MappedSequence.get\", &[\"key\"], args);\n                let key = iter.next_arg::<&Value>()?;\n                let default = iter.next_kwarg::<Option<&Value>>(\"default\")?;\n                iter.finish()?;\n                let value = self.get(key, default);\n                Ok(value)\n            }\n            \"dict\" => {\n                assert_nullary_args!(\"MappedSequence.items\", args)?;\n                if let Some(dict) = self.dict() {\n                    Ok(Value::from_object(dict))","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-agate/src/lib.rs#L696-L732","documentation":"Raised from MappedSequence.keys in the Jinja object emulation: the underlying sequence type does not provide a keys() implementation (keys() returned None), so the keys view cannot be produced. Approximates a KeyError per the code comment; the type named in the message is the at-fault input.","triggerScenarios":"Thrown at crates/dbt-agate/src/lib.rs:714 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call keys() only on mapped sequence types that define it (e.g. those backed by a mapping)","Use items() or iterate the sequence directly when keys are unavailable","Add a keys() implementation to the underlying MappedSequence subtype"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}