{"record":{"id":"9831af58c465e339","repo":"astrid-runtime/astrid","slug":"running-daemon-belongs-to-another-project-or-works","errorCode":null,"errorMessage":"running daemon belongs to another project or workspace layout; run `astrid restart` from this project","messagePattern":"running daemon belongs to another project or workspace layout; run `astrid restart` from this project","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/daemon/workspace_fingerprint.rs","lineNumber":75,"sourceCode":"        if !fingerprints.contains(&fingerprint) {\n            fingerprints.push(fingerprint);\n        }\n    }\n    Ok(fingerprints)\n}\n\n/// Validate the versioned readiness metadata emitted by the daemon.\npub(crate) fn validate_daemon_workspace_metadata(\n    metadata: &str,\n    expected: &[String],\n) -> Result<()> {\n    let Some(actual) = metadata.trim().strip_prefix(\"v1:\") else {\n        anyhow::bail!(\n            \"running daemon does not expose workspace selection metadata; run `astrid restart`\"\n        );\n    };\n    if !expected.iter().any(|fingerprint| fingerprint == actual) {\n        anyhow::bail!(\n            \"running daemon belongs to another project or workspace layout; run `astrid restart` from this project\"\n        );\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn runtime_home_accepts_aos_fingerprint_for_default_cli_layout() {\n        let home_root = tempfile::tempdir().expect(\"home root\");\n        let project_root = tempfile::tempdir().expect(\"project root\");\n        let resolved_home = AstridHome::from_path(home_root.path());\n        let layouts = layouts_for_workspace_root(home_root.path(), &resolved_home);\n\n        let names = layouts","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/daemon/workspace_fingerprint.rs#L57-L93","documentation":"After stripping the `v1:` prefix, validate_daemon_workspace_metadata compares the daemon's fingerprint against the list of expected workspace fingerprints. If none match, the running daemon was started for a different project or workspace layout than the one this CLI invocation targets.","triggerScenarios":"Running CLI commands for project A while the daemon was started from project B; the workspace layout changed (members added/removed) so the fingerprint no longer matches any expected value.","commonSituations":"Switching projects in a shell while a daemon from the previous project is still running; editing Distro.toml workspace members after starting the daemon; sharing one daemon across multiple checkouts.","solutions":["Run `astrid restart` from the project directory so the daemon adopts this project's layout","Confirm you are in the intended project directory and that Distro.toml matches the daemon's workspace","Regenerate/verify the expected fingerprints after changing workspace layout, then restart the daemon"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"let matches = expected.iter().any(|f| Some(f.as_str()) == actual_fingerprint.as_deref());\nif !matches { println!(\"daemon workspace mismatch; run astrid restart from this project\"); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = ensure_daemon_workspace_matches(&home, &expected).await {\n    if e.to_string().contains(\"another project or workspace layout\") {\n        run_restart_from_project_root().await?;\n    } else { return Err(e); }\n}","preventionTips":["Run `astrid restart` whenever you switch projects or edit workspace members","Avoid sharing a single daemon across multiple project checkouts","Regenerate fingerprints after Distro.toml layout changes"],"tags":["daemon","workspace","fingerprint-mismatch"],"backgroundTag":"invalid-state-transition","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}