{"record":{"id":"e2c3cfabf3d02f3c","repo":"risingwavelabs/risingwave","slug":"unexpected-job-type-job-type-for-first-job","errorCode":null,"errorMessage":"unexpected job_type {job_type:?} for first job {} in database {database_id}","messagePattern":"unexpected job_type (.+?) for first job (.+?) in database (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/barrier/checkpoint/control.rs","lineNumber":299,"sourceCode":"\n                        return Ok(());\n                    }\n                }\n            }\n\n            let database = match self.databases.entry(database_id) {\n                Entry::Occupied(entry) => entry\n                    .into_mut()\n                    .expect_running(\"should not have command when not running\"),\n                Entry::Vacant(entry) => match &command {\n                    Command::CreateStreamingJob { info, job_type, .. } => {\n                        let CreateStreamingJobType::Normal = job_type else {\n                            if cfg!(debug_assertions) {\n                                panic!(\n                                    \"unexpected first job of type {job_type:?} with info {info:?}\"\n                                );\n                            } else {\n                                notifier.notify_start_failed(anyhow!(\"unexpected job_type {job_type:?} for first job {} in database {database_id}\", info.streaming_job.id()).into());\n                                return Ok(());\n                            }\n                        };\n                        let new_database = DatabaseCheckpointControl::new(\n                            database_id,\n                            self.env.shared_actor_infos().clone(),\n                        );\n                        let adder = partial_graph_manager.add_partial_graph(\n                            to_partial_graph_id(database_id, None),\n                            new_database.term_id(),\n                            DatabaseCheckpointControlMetrics::new(database_id),\n                        );\n                        adder.added();\n                        entry\n                            .insert(DatabaseCheckpointControlStatus::Running(new_database))\n                            .expect_running(\"just initialized as running\")\n                    }\n                    Command::Flush","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/barrier/checkpoint/control.rs#L281-L317","documentation":"When the first job in a newly created database graph is created, it must be of type `Normal`; any other create type (e.g. snapshot backfill variants) is invalid for the first job. In release builds the job is failed via the notifier with this message instead of panicking.","triggerScenarios":"Submitting a CreateStreamingJob command as the very first job of a database whose job_type is not `Normal` (e.g. creating a sink/backfill-style job as the database's first streaming job) during handle_new_barrier.","commonSituations":"Frontend/meta version mismatch producing an unexpected job type for a database bootstrap; internal bug where a non-normal creation reaches the barrier scheduler as the first job.","solutions":["Retry the CREATE statement; if it persists, it is an internal inconsistency — collect the job_type from the message and file a bug.","Check frontend/meta version alignment (upgrade all components together).","Inspect the job definition that triggered it and avoid creating that job type as the database's first job."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = create_job_result {\n    if e.to_string().starts_with(\"unexpected job_type\") {\n        // internal bug: capture full error + job_type, retry CREATE once, else file a bug\n    }\n}","preventionTips":["Keep frontend and meta nodes on the same version.","Report reproducible cases with the job_type value from the message.","Create a normal streaming job as the first job in a new database."],"tags":["barrier","streaming-job","internal-invariant","database-bootstrap"],"backgroundTag":"invalid-enum-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}