{"record":{"id":"f0084fd1b66c8c2f","repo":"BloopAI/vibe-kanban","slug":"raw-stream-should-only-have-stdout-stderr-finished","errorCode":null,"errorMessage":"Raw stream should only have Stdout/Stderr/Finished","messagePattern":"Raw stream should only have Stdout/Stderr/Finished","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/server/src/routes/execution_processes.rs","lineNumber":102,"sourceCode":"        }\n    };\n\n    let counter = Arc::new(AtomicUsize::new(0));\n    let mut stream = raw_stream.map_ok({\n        let counter = counter.clone();\n        move |m| match m {\n            LogMsg::Stdout(content) => {\n                let index = counter.fetch_add(1, Ordering::SeqCst);\n                let patch = ConversationPatch::add_stdout(index, content);\n                LogMsg::JsonPatch(patch).to_ws_message_unchecked()\n            }\n            LogMsg::Stderr(content) => {\n                let index = counter.fetch_add(1, Ordering::SeqCst);\n                let patch = ConversationPatch::add_stderr(index, content);\n                LogMsg::JsonPatch(patch).to_ws_message_unchecked()\n            }\n            LogMsg::Finished => LogMsg::Finished.to_ws_message_unchecked(),\n            _ => unreachable!(\"Raw stream should only have Stdout/Stderr/Finished\"),\n        }\n    });\n\n    loop {\n        tokio::select! {\n            item = stream.next() => {\n                match item {\n                    Some(Ok(msg)) => {\n                        if socket.send(msg).await.is_err() {\n                            break;\n                        }\n                    }\n                    Some(Err(e)) => {\n                        tracing::error!(\"stream error: {}\", e);\n                        break;\n                    }\n                    None => break,\n                }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/server/src/routes/execution_processes.rs#L84-L120","documentation":"In handle_raw_logs_ws, the raw execution-process log stream is mapped to WebSocket messages. Only Stdout, Stderr, and Finished are expected from the raw channel; any other LogMsg variant hits `unreachable!(\"Raw stream should only have Stdout/Stderr/Finished\")`. This asserts the raw log channel's contract — e.g. if the upstream log source starts emitting JsonPatch or other control variants, the handler panics.","triggerScenarios":"A LogMsg arrives on the raw logs stream that is not Stdout/Stderr/Finished — e.g. the log broadcaster emits JsonPatch or control messages on the raw channel, or a new LogMsg variant was added without updating this mapping.","commonSituations":"Executor changes that route structured (JsonPatch) output through the raw stream; a shared log channel reused for both normalized and raw subscribers; adding a LogMsg variant upstream without touching this endpoint.","solutions":["Inspect the backtrace/log to identify the unexpected LogMsg variant and either filter it out before mapping or add an explicit arm.","Ensure the raw logs channel is only fed by raw stdout/stderr/finished producers, not the JsonPatch-producing normalized stream.","Replace the wildcard `_` arm with an explicit enumeration so compilation fails when new LogMsg variants are added."],"exampleFix":"// before\n_ => unreachable!(\"Raw stream should only have Stdout/Stderr/Finished\"),\n// after\nLogMsg::JsonPatch(_) => continue, // or handle explicitly\n_ => unreachable!(\"Raw stream should only have Stdout/Stderr/Finished\"),","handlingStrategy":"try-catch","validationCode":"// Producer side: only emit raw variants\nassert!(matches!(msg, LogMsg::Stdout(_)|LogMsg::Stderr(_)|LogMsg::Finished));","typeGuard":null,"tryCatchPattern":"match log_msg {\n  LogMsg::Stdout(_) | LogMsg::Stderr(_) | LogMsg::Finished => { /* map */ }\n  other => {\n    tracing::warn!(\"unexpected raw log variant: {:?}\", other);\n    // skip instead of panicking\n  }\n}","preventionTips":["Keep the raw log channel separate from JsonPatch-producing normalized streams","Enumerate variants explicitly instead of a `_` catch-all so new LogMsg kinds break compilation","On protocol changes to LogMsg, audit all WS endpoints including raw logs"],"tags":["rust","panic","websocket","streaming"],"backgroundTag":"unhandled-enum-variant","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}