{"record":{"id":"9af73983ec660fbf","repo":"warpdotdev/warp","slug":"vcpus-is-required-when-setting-an-instance-shape","errorCode":null,"errorMessage":"--vcpus is required when setting an instance shape for a runner that has none","messagePattern":"--vcpus is required when setting an instance shape for a runner that has none","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/runner.rs","lineNumber":390,"sourceCode":"        (true, Some(name)) => name.to_string(),\n        _ => existing_name.to_string(),\n    }\n}\n\n/// Merge instance-shape overrides with the existing shape (`(vcpus, memory_gb)`),\n/// allowing vCPUs and memory to be updated independently. Returns `None` when\n/// there is no shape to set, or an error when only one dimension is provided for\n/// a runner that has no existing shape to supply the other.\nfn merge_instance_shape(\n    new_vcpus: Option<i32>,\n    new_memory_gb: Option<i32>,\n    existing: Option<(i32, i32)>,\n) -> Result<Option<(i32, i32)>> {\n    if new_vcpus.is_none() && new_memory_gb.is_none() {\n        return Ok(existing);\n    }\n    let vcpus = new_vcpus.or(existing.map(|(v, _)| v)).ok_or_else(|| {\n        anyhow!(\"--vcpus is required when setting an instance shape for a runner that has none\")\n    })?;\n    let memory_gb = new_memory_gb.or(existing.map(|(_, m)| m)).ok_or_else(|| {\n        anyhow!(\"--memory-gb is required when setting an instance shape for a runner that has none\")\n    })?;\n    Ok(Some((vcpus, memory_gb)))\n}\n\nfn os_to_gql(os: RunnerOsArg) -> RunnerOs {\n    match os {\n        RunnerOsArg::Linux => RunnerOs::Linux,\n        RunnerOsArg::Macos => RunnerOs::Macos,\n    }\n}\n\n/// Resolve a [`RunnerArchArg`] into a concrete [`RunnerArch`], mapping `auto`\n/// to the default architecture for the given OS (x86-64 on Linux, aarch64 on\n/// macOS).\nfn resolve_arch(arch: RunnerArchArg, os: RunnerOsArg) -> RunnerArch {","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/runner.rs#L372-L408","documentation":"merge_instance_shape composes the (vcpus, memory_gb) pair for a runner update from new flags plus the runner's existing shape. If exactly one of --vcpus/--memory-gb is provided and the runner has no existing shape, the other dimension has no source, so the update is rejected instead of silently defaulting. This error fires when --vcpus is the missing dimension.","triggerScenarios":"oz runner update --memory-gb 8 (vcpus flag absent) on a runner whose current config has no instance shape, so vcpus cannot be inherited from existing.","commonSituations":"Trying to scale one dimension of a freshly created shapeless runner; assuming the server fills in a default for the missing dimension; copying a partial update command from docs or a teammate.","solutions":["Pass both dimensions together: --vcpus N --memory-gb M","If you truly want to change only one dimension, first establish a full shape, then later single-dimension updates inherit the other from it"],"exampleFix":"// before\noz runner update --uid rnr_x --memory-gb 8\n# Error: --vcpus is required when setting an instance shape for a runner that has none\n\n// after\noz runner update --uid rnr_x --vcpus 4 --memory-gb 8","handlingStrategy":"validation","validationCode":"let existing: Option<(i32, i32)> = runner.instance_shape();\nif existing.is_none() && (vcpus.is_some() ^ memory_gb.is_some()) {\n    anyhow::bail!(\"shapeless runner: pass both --vcpus and --memory-gb\");\n}\nmerge_instance_shape(vcpus, memory_gb, existing)?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set vcpus and memory together when first shaping a runner","Validate the flag pair in wrappers before calling the CLI","Remember single-dimension updates only work once a shape exists"],"tags":["agent-sdk","runner","cli","instance-shape","validation"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}