astrid-runtime/astrid · error

running daemon belongs to another project or workspace layou

Error message

running daemon belongs to another project or workspace layout; run `astrid restart` from this project

What it means

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.

Source

Thrown at crates/astrid-cli/src/commands/daemon/workspace_fingerprint.rs:75

        if !fingerprints.contains(&fingerprint) {
            fingerprints.push(fingerprint);
        }
    }
    Ok(fingerprints)
}

/// Validate the versioned readiness metadata emitted by the daemon.
pub(crate) fn validate_daemon_workspace_metadata(
    metadata: &str,
    expected: &[String],
) -> Result<()> {
    let Some(actual) = metadata.trim().strip_prefix("v1:") else {
        anyhow::bail!(
            "running daemon does not expose workspace selection metadata; run `astrid restart`"
        );
    };
    if !expected.iter().any(|fingerprint| fingerprint == actual) {
        anyhow::bail!(
            "running daemon belongs to another project or workspace layout; run `astrid restart` from this project"
        );
    }
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn runtime_home_accepts_aos_fingerprint_for_default_cli_layout() {
        let home_root = tempfile::tempdir().expect("home root");
        let project_root = tempfile::tempdir().expect("project root");
        let resolved_home = AstridHome::from_path(home_root.path());
        let layouts = layouts_for_workspace_root(home_root.path(), &resolved_home);

        let names = layouts

View on GitHub (pinned to affd8760f4)

Solutions

  1. Run `astrid restart` from the project directory so the daemon adopts this project's layout
  2. Confirm you are in the intended project directory and that Distro.toml matches the daemon's workspace
  3. Regenerate/verify the expected fingerprints after changing workspace layout, then restart the daemon
Defensive patterns

Strategy: try-catch

Validate before calling

let matches = expected.iter().any(|f| Some(f.as_str()) == actual_fingerprint.as_deref());
if !matches { println!("daemon workspace mismatch; run astrid restart from this project"); }

Try / catch

if let Err(e) = ensure_daemon_workspace_matches(&home, &expected).await {
    if e.to_string().contains("another project or workspace layout") {
        run_restart_from_project_root().await?;
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/9831af58c465e339. Report an issue: GitHub.