{"record":{"id":"9acf8cca1264f53d","repo":"cross-rs/cross","slug":"a-persistent-volume-does-not-exists-for-0-but-there-is-a","errorCode":null,"errorMessage":"a persistent volume does not exists for `{0}`, but there is a volume for a different version.\n > Create a new volume with `cross-util volumes create --toolchain {0}`","messagePattern":"a persistent volume does not exists for `(.+?)`, but there is a volume for a different version\\.\n > Create a new volume with `cross-util volumes create --toolchain (.+?)`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/docker/remote.rs","lineNumber":792,"sourceCode":"    // 8. stop container and delete data volume\n    //\n    // we use structs that wrap the resources to ensure they're dropped\n    // in the correct order even on error, to ensure safe cleanup\n\n    // 1. get our unique identifiers and cleanup from a previous run.\n    // this can happen if we didn't gracefully exit before\n    // note that since we use `docker run --rm`, it's very\n    // unlikely the container state existed before.\n    let toolchain_id = toolchain_dirs.unique_toolchain_identifier()?;\n    let container_id = toolchain_dirs.unique_container_identifier(target.target())?;\n    let volume = {\n        let existing = DockerVolume::existing(engine, toolchain_dirs.toolchain(), msg_info)?;\n        if existing.iter().any(|v| v == &toolchain_id) {\n            VolumeId::Keep(toolchain_id)\n        } else {\n            let partial = format!(\"{VOLUME_PREFIX}{}\", toolchain_dirs.toolchain());\n            if existing.iter().any(|v| v.starts_with(&partial)) {\n                msg_info.warn(format_args!(\n                    \"a persistent volume does not exists for `{0}`, but there is a volume for a different version.\\n > Create a new volume with `cross-util volumes create --toolchain {0}`\",\n                    toolchain_dirs.toolchain()\n                ))?;\n            }\n            VolumeId::Discard\n        }\n    };\n\n    let container = DockerContainer::new(engine, &container_id);\n    let state = container.state(msg_info)?;\n    if !state.is_stopped() {\n        msg_info.warn(format_args!(\"container {container_id} was running.\"))?;\n        container.stop_default(msg_info)?;\n    }\n    if state.exists() {\n        msg_info.warn(format_args!(\"container {container_id} was exited.\"))?;\n        container.remove(msg_info)?;\n    }","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/docker/remote.rs#L774-L810","documentation":"In remote mode, cross can reuse a persistent toolchain volume. run() lists existing volumes: if the exact versioned toolchain volume is missing but another volume sharing the toolchain prefix exists (a different cross/toolchain version), it warns and points to `cross-util volumes create --toolchain`, then proceeds with a discarded (temporary) volume.","triggerScenarios":"run() in remote mode when DockerVolume::existing returns no volume equal to toolchain_id but at least one volume starts with VOLUME_PREFIX + toolchain name (built with an older/newer cross or toolchain version).","commonSituations":"After upgrading cross or the Rust toolchain while keeping old volumes; switching between cross versions in CI causing versioned volume name mismatches.","solutions":["Run `cross-util volumes create --toolchain <toolchain>` to create the matching persistent volume, as the message suggests.","Remove stale volumes from old versions (`cross-util volumes remove` or `docker volume rm`) to avoid confusion.","Pin the cross version in CI so the versioned volume name stays consistent across runs."],"exampleFix":"# before\ncross build --remote --target aarch64-unknown-linux-gnu\n# warns: volume for different version\n\n# after\ncross-util volumes create --toolchain aarch64-unknown-linux-gnu\ncross build --remote --target aarch64-unknown-linux-gnu","handlingStrategy":"validation","validationCode":"# Ensure the exact toolchain volume exists before a remote build\nprefix=\"cross-dev-tools-<toolchain>\"\ndocker volume ls --format '{{.Name}}' | grep -Fx \"$prefix-<version>\" \\\n  || { echo \"creating toolchain volume\"; cross-util volumes create --toolchain <toolchain>; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create toolchain volumes explicitly with cross-util after upgrading cross","Pin the cross version in CI to keep volume names stable","Prune volumes from old toolchain versions"],"tags":["docker","remote","volume","toolchain"],"backgroundTag":"resource-not-found","analyzedSha":"8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27","analyzedAt":"2026-09-13T15:10:43.988Z","contentChangedAt":"2026-09-13T15:10:43.988Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}