{"record":{"id":"b2fd3d0a289d1f8b","repo":"nikivdev/code","slug":"bike-app-failed-to-open","errorCode":null,"errorMessage":"Bike.app failed to open {}","messagePattern":"Bike\\.app failed to open (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/todo.rs","lineNumber":90,"sourceCode":"    };\n    if needs_init {\n        let content = render_bike_template(&project_name);\n        fs::write(&path, content)?;\n    }\n\n    let bike_app = Path::new(\"/System/Volumes/Data/Applications/Bike.app\");\n    if !bike_app.exists() {\n        bail!(\"Bike.app not found at {}\", bike_app.display());\n    }\n\n    let status = Command::new(\"open\")\n        .arg(\"-a\")\n        .arg(bike_app)\n        .arg(&path)\n        .status()\n        .context(\"failed to launch Bike.app\")?;\n    if !status.success() {\n        bail!(\"Bike.app failed to open {}\", path.display());\n    }\n\n    Ok(())\n}\n\nfn looks_like_bike(content: &str) -> bool {\n    let trimmed = content.trim_start();\n    if !trimmed.starts_with(\"<?xml\") {\n        return false;\n    }\n    let lower = trimmed.to_ascii_lowercase();\n    lower.contains(\"<html\") && lower.contains(\"<body\") && lower.contains(\"<ul\")\n}\n\nfn render_bike_template(project_name: &str) -> String {\n    let now = Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true);\n    let ul_id = format!(\"_{}\", Uuid::new_v4().simple());\n    let li_id = Uuid::new_v4().simple().to_string();","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/todo.rs#L72-L108","documentation":"Raised by open_bike (src/todo.rs:90) when the `open -a Bike.app <file>` subprocess completes but reports unsuccessful (non-zero exit). Bike.app was found (existence check passed at line 80), but launching it or opening the todo file with it failed.","triggerScenarios":"The `open` command exits non-zero — e.g. Bike.app is quarantined/damaged, refuses to open the .hoops file, LaunchServices cannot associate the file type, or the system is in a state where GUI apps cannot launch (SSH session, headless CI).","commonSituations":"Running the todo open command over SSH or from a non-GUI context where `open` cannot launch apps; corrupted or moved Bike.app after the exists() check; file permissions preventing Bike.app from opening the todo path.","solutions":["Run `open -a Bike.app <path>` manually to see the actual LaunchServices error message.","Ensure you are in a GUI session (not SSH) or enable remote Apple Events / run inside a logged-in desktop session.","Reinstall or repair Bike.app; clear quarantine with `xattr -dr com.apple.quarantine /path/to/Bike.app`.","Verify the todo file exists and is readable by the current user."],"exampleFix":"// before\nbail!(\"Bike.app failed to open {}\", path.display());\n// after: capture stderr for diagnosis\nlet out = Command::new(\"open\").arg(\"-a\").arg(&bike_app).arg(&path).output()?;\nif !out.status.success() {\n    bail!(\"Bike.app failed to open {}: {}\", path.display(), String::from_utf8_lossy(&out.stderr));\n}","handlingStrategy":"try-catch","validationCode":"// ensure a GUI session can launch apps before calling\nlet gui = std::env::var(\"TERM_PROGRAM\").is_ok() || std::env::var(\"Apple_PubSub_Socket_Render\").is_ok();\nif !gui { eprintln!(\"no GUI session; `open -a` will fail\"); }","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Bike.app failed to open\") => {\n        eprintln!(\"launch failed; try `open -a Bike.app` manually and check stderr\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Do not run GUI-launching commands over SSH or in headless CI.","Keep Bike.app updated and quarantine-free (xattr check after install).","Confirm LaunchServices can open the todo file type by opening it once manually."],"tags":["macos","subprocess","app-launch"],"backgroundTag":"subprocess-nonzero-exit","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}