{"record":{"id":"d02d4ffdea5020fc","repo":"risingwavelabs/risingwave","slug":"internal-error-0","errorCode":null,"errorMessage":"internal error: {0}","messagePattern":"internal error: (.+?)","errorType":"error_code","errorClass":"ErrorCode::InternalError","httpStatus":null,"severity":"error","filePath":"src/frontend/src/error.rs","lineNumber":43,"sourceCode":"use risingwave_pb::PbFieldNotFound;\nuse risingwave_rpc_client::error::{RpcError, ToTonicStatus, TonicStatusWrapper};\nuse thiserror::Error;\nuse thiserror_ext::AsReport;\nuse tokio::task::JoinError;\n\nuse crate::expr::CastError;\n\n/// The error type for the frontend crate, acting as the top-level error type for the\n/// entire RisingWave project.\n// TODO(error-handling): this is migrated from the `common` crate, and there could\n// be some further refactoring to do:\n// - Some variants are never constructed.\n// - Some variants store a type-erased `BoxedError` to resolve the reverse dependency.\n//   It's not necessary anymore as the error type is now defined at the top-level.\n#[derive(Error, thiserror_ext::ReportDebug, thiserror_ext::Box, thiserror_ext::Macro)]\n#[thiserror_ext(newtype(name = RwError, backtrace), macro(path = \"crate::error\"))]\npub enum ErrorCode {\n    #[error(\"internal error: {0}\")]\n    InternalError(String),\n    // TODO: unify with the above\n    #[error(transparent)]\n    Uncategorized(\n        #[from]\n        #[backtrace]\n        anyhow::Error,\n    ),\n    #[error(\"connector error: {0}\")]\n    ConnectorError(\n        #[source]\n        #[backtrace]\n        BoxedError,\n    ),\n    #[error(transparent)]\n    NotImplemented(#[from] NotImplemented),\n    // Tips: Use this only if it's intended to reject the query\n    #[error(\"Not supported: {0}\\nHINT: {1}\")]","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/error.rs#L25-L61","documentation":"This is RisingWave's generic `ErrorCode::InternalError` variant, a catch-all for invariant violations inside the frontend that do not map to a more specific error code. It signals a bug or an unexpected internal state, not a user-facing SQL problem. The message embeds a free-form `String` describing what the internal code found surprising.","triggerScenarios":"Any frontend code path calls `internal_error!`/`ErrorCode::InternalError` when an assumption is violated: unhandled enum arms, impossible states after planning, failed conversions that 'cannot happen', or bugs surfaced via macros like `internal_error!(\"...\")`.","commonSituations":"Hitting a planner/binder code path with an unsupported but unguarded input, upgrading RisingWave and triggering a previously unreached code path, or a genuine bug where a `match` lacked a case.","solutions":["Read the embedded message to identify the violated invariant and the file that produced it","Capture the full error report/backtrace (RwError carries backtrace) and the SQL statement that triggered it","Search the RisingWave repo or issue tracker for the message text to find a known bug","Work around by reformulating the SQL (e.g. different expression or join order) if a planner path is implicated","File a bug with the statement, schema, and backtrace if reproducible"],"exampleFix":"// before (code producing the error)\nmatch node { Node::A => .., Node::B => .. } // missing arm -> internal_error at runtime\n// after\nmatch node { Node::A => .., Node::B => .., Node::C => handle_c() }","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"fn is_internal_error(e: &risingwave_common::error::RwError) -> bool { matches!(e.get_code(), risingwave_common::error::ErrorCode::InternalError(_)) }","tryCatchPattern":"match result { Err(e) if matches!(e.get_code(), ErrorCode::InternalError(_)) => { log::error!(\"RW internal error: {}\", e); report_bug(e); }, other => other }","preventionTips":["Keep RisingWave upgraded to pick up invariant fixes","Capture full backtraces and statements when reporting","Avoid relying on undocumented edge-case SQL behavior","Add regression tests for exotic queries before production use"],"tags":["internal-error","frontend","bug"],"backgroundTag":"internal-invariant-violation","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"}