{"record":{"id":"e8c06e1bbfde3998","repo":"risingwavelabs/risingwave","slug":"bug-worker-not-found-for-new-actor","errorCode":null,"errorMessage":"BUG: Worker not found for new actor {}","messagePattern":"BUG: Worker not found for new actor (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/stream/scale.rs","lineNumber":674,"sourceCode":"    all_actor_dispatchers: HashMap<ActorId, Vec<PbDispatcher>>,\n    job_extra_info: Option<&StreamingJobExtraInfo>,\n) -> MetaResult<Reschedule> {\n    let prev_ids: HashSet<_> = prev_fragment_info.actors.keys().cloned().collect();\n    let curr_ids: HashSet<_> = curr_actors.keys().cloned().collect();\n\n    let removed_actors: HashSet<_> = &prev_ids - &curr_ids;\n    let added_actor_ids: HashSet<_> = &curr_ids - &prev_ids;\n    let kept_ids: HashSet<_> = prev_ids.intersection(&curr_ids).cloned().collect();\n    debug_assert!(\n        kept_ids.is_empty(),\n        \"kept actors found in scale; expected full rebuild, prev={prev_ids:?}, curr={curr_ids:?}, kept={kept_ids:?}\"\n    );\n\n    let mut added_actors = HashMap::new();\n    for &actor_id in &added_actor_ids {\n        let InflightActorInfo { worker_id, .. } = curr_actors\n            .get(&actor_id)\n            .ok_or_else(|| anyhow!(\"BUG: Worker not found for new actor {}\", actor_id))?;\n\n        added_actors\n            .entry(*worker_id)\n            .or_insert_with(Vec::new)\n            .push(actor_id);\n    }\n\n    let mut vnode_bitmap_updates = HashMap::new();\n    for actor_id in kept_ids {\n        let prev_actor = &prev_fragment_info.actors[&actor_id];\n        let curr_actor = &curr_actors[&actor_id];\n\n        // Check if the vnode distribution has changed.\n        if prev_actor.vnode_bitmap != curr_actor.vnode_bitmap\n            && let Some(bitmap) = curr_actor.vnode_bitmap.clone()\n        {\n            vnode_bitmap_updates.insert(actor_id, bitmap);\n        }","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/stream/scale.rs#L656-L692","documentation":"In `diff_fragment`, after computing `added_actor_ids` (actors present in the new plan but not the old), the code looks each new actor up in `curr_actors` to find its assigned worker. A new actor missing from that map means the diff and the current actor snapshot are inconsistent — an internal bug — hence the explicit \"BUG:\" prefix. This would otherwise leave added actors with no worker assignment in the produced reschedule commands.","triggerScenarios":"Calling `build_reschedule_commands` where an added actor id exists in the diff result but not in the `curr_actors` map built from the current fragment states — e.g. the diff was computed against a different snapshot than the actor lookup, or `added_actor_ids` derivation is buggy.","commonSituations":"Concurrent modification of the fragment state between diff computation and actor lookup; a meta internal bug in actor-id bookkeeping during scale-out planning; testing with mocked render results that don't align with curr_actors.","solutions":["Treat as a meta bug: capture the actor id from the message and report it with the reschedule that triggered it.","Retry the reschedule; a transient race may resolve once snapshots are consistent.","Check that no concurrent reschedule runs against the same job, which could desynchronize the snapshots.","Review the diff logic (added_actor_ids derivation vs curr_actors source) for a version/branch mismatch in how snapshots are collected."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// \"BUG:\" errors are not user-recoverable; capture diagnostics and retry once\nmatch build_reschedule_from_context(ctx).await {\n    Err(e) if e.to_string().contains(\"BUG: Worker not found\") => {\n        error!(\"meta invariant violated: {e}\");\n        sleep(backoff).await;\n        build_reschedule_from_context(rebuild(ctx)).await\n    }\n    r => r,\n}","preventionTips":["Avoid triggering reschedules concurrently on the same job to keep snapshots consistent.","Keep meta and compute node versions aligned to avoid snapshot format drift.","Report occurrences to maintainers — the message is explicitly an internal bug marker."],"tags":["reschedule","invariant","scale"],"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-14T11:17:12.474Z"}