{"record":{"id":"64009a504ac5523c","repo":"influxdata/influxdb","slug":"cannot-delete-internal-db","errorCode":null,"errorMessage":"cannot delete internal db","messagePattern":"cannot delete internal db","errorType":"error_code","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/error.rs","lineNumber":291,"sourceCode":"        context: Option<String>,\n    },\n\n    #[error(\"invalid error behavior {0}\")]\n    InvalidErrorBehavior(String),\n\n    #[error(\"cannot parse token permission, {0}\")]\n    CannotParsePermissionForToken(String),\n\n    #[error(\"token name already exists, {0}\")]\n    TokenNameAlreadyExists(String),\n\n    #[error(\"token hash already exists\")]\n    TokenHashAlreadyExists,\n\n    #[error(\"missing admin token, cannot update\")]\n    MissingAdminTokenToUpdate,\n\n    #[error(\"cannot delete internal db\")]\n    CannotDeleteInternalDatabase,\n\n    #[error(\"cannot modify internal db\")]\n    CannotModifyInternalDatabase,\n\n    #[error(\"tried to stop a node ({node_id}) that is already stopped\")]\n    NodeAlreadyStopped { node_id: Arc<str> },\n\n    #[error(\n        \"node '{node_id}' is not fully stopped (current state: {current_state}); run \\\"stop node\\\" first\"\n    )]\n    NodeNotFullyStopped {\n        node_id: Arc<str>,\n        current_state: &'static str,\n    },\n\n    #[error(\"node '{node_id}' has compact mode and cannot be removed\")]\n    NodeModeNotRemovable { node_id: Arc<str> },","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/error.rs#L273-L309","documentation":"This error is returned when an operation attempts to delete an internal database (databases reserved by the system, e.g. those with `_`-prefixed system names). Internal databases are managed by InfluxDB itself and cannot be removed through user-facing catalog APIs, so the request is rejected.","triggerScenarios":"Calling database deletion (e.g. `delete_database` or the corresponding HTTP DELETE endpoint) against a reserved/internal database name.","commonSituations":"Automation scripts iterating over all databases and deleting them; attempting to clean up what looks like a stale system database; misconfigured tools that don't filter internal DB names.","solutions":["Exclude internal/system databases (e.g. names starting with `_`) from deletion logic","Check the database name in the request for a stray system DB","If disk space is the concern, use retention policies or compactor cleanup instead of deleting internal DBs","Contact support/consider re-provisioning only if a system DB is genuinely corrupted"],"exampleFix":"// before\nfor db in catalog.list_databases() {\n    catalog.delete_database(&db.name)?;\n}\n// after\nfor db in catalog.list_databases() {\n    if !db.name.starts_with('_') {\n        catalog.delete_database(&db.name)?;\n    }\n}","handlingStrategy":"validation","validationCode":"fn is_internal_db(name: &str) -> bool { name.starts_with('_') }\nfn can_delete(name: &str) -> bool { !is_internal_db(name) }","typeGuard":null,"tryCatchPattern":"match delete_database(name) {\n    Err(CatalogError::CannotDeleteInternalDatabase) => {/* skip system db */},\n    r => r,\n}","preventionTips":["Filter `_`-prefixed databases out of bulk-delete scripts","Whitelist deletable databases instead of blacklisting","Document that internal DBs are immutable"],"tags":["catalog","database","protected-resource"],"backgroundTag":"permission-denied","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"}