risingwavelabs/risingwave · error

unexpected job_type {job_type:?} for first job {} in databas

Error message

unexpected job_type {job_type:?} for first job {} in database {database_id}

What it means

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.

Source

Thrown at src/meta/src/barrier/checkpoint/control.rs:299

                        return Ok(());
                    }
                }
            }

            let database = match self.databases.entry(database_id) {
                Entry::Occupied(entry) => entry
                    .into_mut()
                    .expect_running("should not have command when not running"),
                Entry::Vacant(entry) => match &command {
                    Command::CreateStreamingJob { info, job_type, .. } => {
                        let CreateStreamingJobType::Normal = job_type else {
                            if cfg!(debug_assertions) {
                                panic!(
                                    "unexpected first job of type {job_type:?} with info {info:?}"
                                );
                            } else {
                                notifier.notify_start_failed(anyhow!("unexpected job_type {job_type:?} for first job {} in database {database_id}", info.streaming_job.id()).into());
                                return Ok(());
                            }
                        };
                        let new_database = DatabaseCheckpointControl::new(
                            database_id,
                            self.env.shared_actor_infos().clone(),
                        );
                        let adder = partial_graph_manager.add_partial_graph(
                            to_partial_graph_id(database_id, None),
                            new_database.term_id(),
                            DatabaseCheckpointControlMetrics::new(database_id),
                        );
                        adder.added();
                        entry
                            .insert(DatabaseCheckpointControlStatus::Running(new_database))
                            .expect_running("just initialized as running")
                    }
                    Command::Flush

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Retry the CREATE statement; if it persists, it is an internal inconsistency — collect the job_type from the message and file a bug.
  2. Check frontend/meta version alignment (upgrade all components together).
  3. Inspect the job definition that triggered it and avoid creating that job type as the database's first job.
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = create_job_result {
    if e.to_string().starts_with("unexpected job_type") {
        // internal bug: capture full error + job_type, retry CREATE once, else file a bug
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/e2c3cfabf3d02f3c. Report an issue: GitHub.