{"record":{"id":"61f89846b67a36d2","repo":"influxdata/influxdb","slug":"cannot-add-column-name-because-it-already-exists-with-type","errorCode":null,"errorMessage":"cannot add column {name} because it already exists with type {existing}","messagePattern":"cannot add column (.+?) because it already exists with type (.+?)","errorType":"error_code","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/error.rs","lineNumber":339,"sourceCode":"    },\n\n    #[error(\"idempotent no-op\")]\n    IdempotentNoOp,\n\n    #[error(\"cannot delete operator token\")]\n    CannotDeleteOperatorToken,\n\n    #[error(\n        \"cannot change the configured generation duration for level {level}; \\\n        attempted to set to {attempted:#} but its already set to {existing:#}\"\n    )]\n    CannotChangeGenerationDuration {\n        level: u8,\n        existing: Duration,\n        attempted: Duration,\n    },\n\n    #[error(\"cannot add column {name} because it already exists with type {existing}\")]\n    DuplicateColumn {\n        name: Arc<str>,\n        existing: InfluxColumnType,\n    },\n\n    #[error(\n        \"record id {record_id} exceeds the cluster's committed feature level (core={}, enterprise={}); \\\n        the cluster must finish upgrading before this operation is available\",\n        committed.core,\n        committed.enterprise,\n    )]\n    RecordExceedsCommittedFeatureLevel {\n        record_id: u16,\n        committed: FeatureLevel,\n    },\n\n    #[error(\n        \"this node's feature level (core={}, enterprise={}) is below the cluster's committed level (core={}, enterprise={}); upgrade required\",","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/error.rs#L321-L357","documentation":"Thrown when a schema update attempts to add a column whose name already exists in the table's schema, and the existing column has a type (reported in the message). Schema evolution in the catalog forbids duplicate column names, even for identical types, via the add-column path.","triggerScenarios":"Calling table schema add_columns / the write path with inferred schema when a field or tag name collides with an existing column; re-running a migration that adds a column already added.","commonSituations":"Line-protocol writes where a new field name matches an existing tag (or vice versa); idempotent schema migrations reapplied; renamed ingestion sources producing colliding field names.","solutions":["Check the table schema for the column before adding; skip or use the existing column.","If the write path inferred the wrong type, align your data's field/tag naming with the existing schema.","Make migrations idempotent: add the column only when it is absent.","If a type conflict is the real issue, plan a new column name rather than reusing the existing one."],"exampleFix":"// before\ntable_def.add_column(\"region\", InfluxColumnType::Tag)?;\n// after\nif table_def.column_exists(\"region\") {\n    // reuse existing column\n} else {\n    table_def.add_column(\"region\", InfluxColumnType::Tag)?;\n}","handlingStrategy":"validation","validationCode":"if let Some(col) = table_def.column(\"{name}\") {\n    // column exists; skip add or reuse it\n    return Ok(());\n}","typeGuard":"fn column_absent(t: &TableDefinition, name: &str) -> bool { t.columns().iter().all(|c| c.name() != name) }","tryCatchPattern":"match result {\n    Err(CatalogError::DuplicateColumn { name, existing }) => {\n        log::debug!(\"column {name} already exists as {existing:?}; reusing\");\n    }\n    other => other?,\n}","preventionTips":["Make schema migrations idempotent","Diff incoming line-protocol fields/tags against current schema","Avoid field/tag name collisions in ingestion payloads"],"tags":["schema","catalog","columns"],"backgroundTag":"schema-validation-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}