BloopAI/vibe-kanban · critical

Execution process path should be valid

Error message

Execution process path should be valid

What it means

Panic raised by `Patch::add` in execution_process_patch when converting the computed JSON Pointer string (e.g. "/execution_processes/<uuid>") into the json_patch crate's `Pointer` type via `try_into()`. The library assumes a UUID-derived pointer is always valid; the expect fires only if the conversion fails, which is treated as an internal invariant violation rather than a recoverable error.

Source

Thrown at crates/services/src/services/events/patches.rs:28

}

/// Helper functions for creating execution process-specific patches
pub mod execution_process_patch {
    use super::*;

    fn execution_process_path(process_id: Uuid) -> String {
        format!(
            "/execution_processes/{}",
            escape_pointer_segment(&process_id.to_string())
        )
    }

    /// Create patch for adding a new execution process
    pub fn add(process: &ExecutionProcess) -> Patch {
        Patch(vec![PatchOperation::Add(AddOperation {
            path: execution_process_path(process.id)
                .try_into()
                .expect("Execution process path should be valid"),
            value: serde_json::to_value(process)
                .expect("Execution process serialization should not fail"),
        })])
    }

    /// Create patch for updating an existing execution process
    pub fn replace(process: &ExecutionProcess) -> Patch {
        Patch(vec![PatchOperation::Replace(ReplaceOperation {
            path: execution_process_path(process.id)
                .try_into()
                .expect("Execution process path should be valid"),
            value: serde_json::to_value(process)
                .expect("Execution process serialization should not fail"),
        })])
    }

    /// Create patch for removing an execution process
    pub fn remove(process_id: Uuid) -> Patch {

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Verify the JSON Pointer segment is escaped: '~' -> '~0', '/' -> '~1' (see escape_pointer_segment at patches.rs:8).
  2. Confirm process.id is a valid Uuid; `Uuid::to_string()` yields only [0-9a-f-] which needs no escaping.
  3. Pin/inspect the json_patch crate version; older versions parse pointers with `Pointer::try_from` and reject strings not starting with '/' or containing malformed escape sequences.
  4. Replace the expect with proper error handling (return Result<Patch, String>) if pointer construction can ever be dynamic.

Example fix

// before
path: execution_process_path(process.id).try_into().expect("Execution process path should be valid"),
// after
let ptr: Pointer = format!("/execution_processes/{}", process.id).try_into()
    .unwrap_or_else(|e| panic!("invalid pointer: {e:?}")); // or propagate an error
Defensive patterns

Strategy: validation

Validate before calling

let path = format!("/execution_processes/{}", process.id);
assert!(path.starts_with('/') && json_patch::Pointer::try_from(path.clone()).is_ok(), "invalid pointer: {path}");

Type guard

fn is_valid_pointer(p: &str) -> bool {
    json_patch::Pointer::try_from(p.to_string()).is_ok()
}

Try / catch

// Rust panics cannot be caught normally; guard the input before the call:
let path = execution_process_path(process.id);
debug_assert!(is_valid_pointer(&path), "bad pointer {path}");
let patch = execution_process_patch::add(&process);

Prevention

When it happens

Trigger: Calling `execution_process_patch::add(&process)` where `execution_process_path(process.id).try_into::<Pointer>()` fails. With a valid Uuid this is practically unreachable; it could only fail if a custom/patched `escape_pointer_segment` produced malformed pointer text (unescaped '~' or '/' in the segment, or a path not starting with '/').

Common situations: Contributors modifying `execution_process_path` or `escape_pointer_segment` and breaking JSON Pointer escaping; swapping the json_patch dependency to a version with stricter Pointer parsing; passing a non-standard process.id type/formatted string after refactoring.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/c3b0e45bd9807d9a. Report an issue: GitHub.