{"record":{"id":"7539d4afc864e65d","repo":"astrid-runtime/astrid","slug":"offline-source-is-not-a-local-file-and-netw","errorCode":null,"errorMessage":"--offline: '{source}' is not a local file and network fetch is forbidden (use a Distro.toml path or a .shuttle archive)","messagePattern":"--offline: '(.+?)' is not a local file and network fetch is forbidden \\(use a Distro\\.toml path or a \\.shuttle archive\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/init_signed_source.rs","lineNumber":162,"sourceCode":"        resolved.push(member);\n    }\n    Ok(resolved)\n}\n\n/// Resolve a distro source to its exact bytes and parse those bytes once.\nasync fn fetch_manifest_bytes(\n    source: &str,\n    offline: bool,\n) -> anyhow::Result<(Vec<u8>, DistroManifest)> {\n    let path = Path::new(source);\n    if path.exists() && path.is_file() {\n        let bytes =\n            std::fs::read(path).with_context(|| format!(\"failed to read {}\", path.display()))?;\n        return parse_manifest_bytes(bytes);\n    }\n\n    if offline {\n        bail!(\n            \"--offline: '{source}' is not a local file and network fetch is forbidden \\\n             (use a Distro.toml path or a .shuttle archive)\"\n        );\n    }\n\n    let url = super::resolve_distro_url(source)?;\n    eprintln!(\"Fetching Distro.toml...\");\n    let bytes = fetch_url_bytes(&url, \"Distro.toml\", 1024 * 1024).await?;\n    parse_manifest_bytes(bytes)\n}\n\nfn parse_manifest_bytes(bytes: Vec<u8>) -> anyhow::Result<(Vec<u8>, DistroManifest)> {\n    anyhow::ensure!(bytes.len() <= 1024 * 1024, \"Distro.toml exceeds 1 MB limit\");\n    let content = std::str::from_utf8(&bytes).context(\"Distro.toml is not valid UTF-8\")?;\n    let manifest = parse_manifest(content)?;\n    Ok((bytes, manifest))\n}\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/init_signed_source.rs#L144-L180","documentation":"fetch_manifest_bytes enforces the --offline flag: when the Distro source is not a local file that can be read directly, and offline mode is active, any network fetch is forbidden and this error is thrown. It tells the user to supply a local Distro.toml path or a local .shuttle archive instead.","triggerScenarios":"Running with --offline while `source` is a URL or registry identifier (not an existing local path); prepare_distro_source/fetch_signed_manifest call fetch_manifest_bytes, which skips the local-read branch and hits the `if offline` bail.","commonSituations":"CI or air-gapped machines running `astrid init --offline <url>`; typo in a local path so it isn't found as a file, causing a network fetch attempt that offline mode blocks.","solutions":["Provide a local Distro.toml file path or a local .shuttle archive as the source.","Pre-download the Distro manifest while online, then re-run with --offline pointing at the local copy.","If network access is actually available and permitted, drop the --offline flag."],"exampleFix":"// before\nastrid init --offline https://distro.example.com/Distro.toml\n\n// after\nwget https://distro.example.com/Distro.toml -O ./Distro.toml\nastrid init --offline ./Distro.toml","handlingStrategy":"validation","validationCode":"# confirm source is a local file when using --offline\nSRC=\"./Distro.toml\"\n[[ -f \"$SRC\" ]] || { echo \"--offline requires a local Distro.toml or .shuttle archive\"; exit 1; }\nastrid init --offline \"$SRC\"","typeGuard":null,"tryCatchPattern":"// shell\nif ! astrid init --offline \"$SRC\" 2>err.log; then\n  grep -q 'network fetch is forbidden' err.log && echo \"pre-download the manifest first\"\nfi","preventionTips":["Pre-download Distro.toml/.shuttle archives before going offline.","Double-check the source path spelling so local files are actually found.","In CI, cache the distro manifest and reference the cached path with --offline."],"tags":["offline","network","cli","distro"],"backgroundTag":"network-request-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}