{"record":{"id":"f3202550b2f25d99","repo":"risingwavelabs/risingwave","slug":"field-name-must-not-be-null","errorCode":null,"errorMessage":"field name must not be null","messagePattern":"field name must not be null","errorType":"exception","errorClass":"ExprError","httpStatus":null,"severity":"error","filePath":"src/expr/core/src/error.rs","lineNumber":105,"sourceCode":"\n    #[error(\"More than one row returned by {0} used as an expression\")]\n    MaxOneRow(&'static str),\n\n    /// TODO: deprecate in favor of `Function`\n    #[error(transparent)]\n    Internal(\n        #[from]\n        #[backtrace]\n        anyhow::Error,\n    ),\n\n    #[error(\"not a constant\")]\n    NotConstant,\n\n    #[error(\"Context {0} not found\")]\n    Context(&'static str),\n\n    #[error(\"field name must not be null\")]\n    FieldNameNull,\n\n    #[error(\"too few arguments for format()\")]\n    TooFewArguments,\n\n    #[error(\n        \"null value in column \\\"{col_name}\\\" of relation \\\"{table_name}\\\" violates not-null constraint\"\n    )]\n    NotNullViolation {\n        col_name: Box<str>,\n        table_name: Box<str>,\n    },\n\n    #[error(\"invalid state: {0}\")]\n    InvalidState(String),\n\n    /// Function error message returned by UDF.\n    /// TODO: replace with `Function`","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/error.rs#L87-L123","documentation":"ExprError::FieldNameNull is thrown when a field name used to access or construct a struct/object field is NULL. Field access by name requires a non-null name string; a null name is meaningless and rejected rather than producing a null result.","triggerScenarios":"Evaluating a `get_field`-style expression where the field-name argument is NULL (e.g. `get_field(obj, some_nullable_col)` where the column is NULL), or constructing structs with a null field name.","commonSituations":"Nullable name columns from upstream data used as field keys, joins that null out the key column, ETL pipelines where field names are computed dynamically.","solutions":["Coalesce the field name to a safe default: `get_field(obj, COALESCE(name_col, 'default_field'))`.","Filter rows with NULL names before the field access.","Fix upstream data so field-name columns are NOT NULL."],"exampleFix":"// before\nSELECT get_field(payload, name_col) FROM t;\n// after\nSELECT CASE WHEN name_col IS NOT NULL THEN get_field(payload, name_col) ELSE NULL END FROM t;","handlingStrategy":"validation","validationCode":"-- guard null field names before get_field\nSELECT CASE WHEN name_col IS NOT NULL THEN get_field(obj, name_col) ELSE NULL END FROM t;","typeGuard":null,"tryCatchPattern":"// Null field name is bad input: return NULL row result instead of failing\nif err.to_string().contains(\"field name must not be null\") {\n    return Ok(None);\n}","preventionTips":["Declare field-name columns NOT NULL upstream when they are used as keys.","COALESCE nullable name columns to a default key.","Filter NULL-name rows before object-field expressions."],"tags":["rust","struct","null"],"backgroundTag":"null-argument","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}