coleam00/Archon · error · Error
Invalid container.memoryMb '${String(memoryMb)}' — must be a
Error message
Invalid container.memoryMb '${String(memoryMb)}' — must be a positive integer (MiB). What it means
resolveContainerBackendConfig() requires container.memoryMb from .archon/config.yaml to be a positive integer when present. `docker run --memory` rejects fractional or non-positive values, so the CLI validates strictly (Number.isInteger and > 0) and fails fast with this error instead of surfacing a runtime docker error.
Source
Thrown at packages/cli/src/commands/workflow.ts:399
* untrusted at runtime despite their static types — validate them here. In
* particular `network` must be `bridge`/`none`: a stray `host` would otherwise
* flow straight to `docker run --network host` and drop the network isolation.
*/
export function resolveContainerBackendConfig(
cfg: { image?: string; network?: string; memoryMb?: number; pidsLimit?: number } | undefined
): ContainerBackendConfig {
const network = cfg?.network;
if (network !== undefined && network !== 'bridge' && network !== 'none') {
throw new Error(
`Invalid container.network '${network}' in .archon/config.yaml — must be ` +
"'bridge' or 'none'. Host networking is not allowed for container isolation."
);
}
// Positive INTEGERS — `docker run --memory`/`--pids-limit` reject fractions,
// and Number.isFinite alone would let `512.5` through to a runtime docker error.
const memoryMb = cfg?.memoryMb;
if (memoryMb !== undefined && (!Number.isInteger(memoryMb) || memoryMb <= 0)) {
throw new Error(
`Invalid container.memoryMb '${String(memoryMb)}' — must be a positive integer (MiB).`
);
}
const pidsLimit = cfg?.pidsLimit;
if (pidsLimit !== undefined && (!Number.isInteger(pidsLimit) || pidsLimit <= 0)) {
throw new Error(
`Invalid container.pidsLimit '${String(pidsLimit)}' — must be a positive integer.`
);
}
return {
image: cfg?.image?.trim() || DEFAULT_RUNNER_IMAGE,
network: network ?? 'bridge',
memoryMb: memoryMb ?? 4096,
pidsLimit: pidsLimit ?? 512,
};
}
/**View on GitHub (pinned to 0773b97458)
Solutions
- Set `container.memoryMb` to a positive whole number of MiB, e.g. `memoryMb: 512`.
- Quote nothing and avoid units: use 1024 for 1 GiB, not '1g'.
- Remove the key to accept the backend default.
Example fix
// .archon/config.yaml (before) container: memoryMb: 512.5 // after container: memoryMb: 512
Defensive patterns
Strategy: validation
Validate before calling
const m = cfg?.container?.memoryMb;
if (m !== undefined && (!Number.isInteger(m) || m <= 0)) {
throw new Error(`container.memoryMb must be a positive integer MiB value, got: ${String(m)}`);
} Type guard
function isPositiveInteger(v: unknown): v is number {
return typeof v === 'number' && Number.isInteger(v) && v > 0;
} Try / catch
try {
await runWorkflow(name, opts);
} catch (e) {
if (String((e as Error).message).includes('Invalid container.memoryMb')) {
console.error('Set container.memoryMb to a whole MiB number, e.g. memoryMb: 512.');
}
} Prevention
- Remember the unit is MiB as a plain integer — no '512m'/'1g' docker strings.
- Convert: 1 GiB = 1024, 2 GiB = 2048.
- Avoid floats when tuning memory; round to whole MiB.
When it happens
Trigger: container.memoryMb set to a float (e.g. 512.5), zero, a negative number, or a non-numeric YAML scalar (string like '512m') passed to resolveContainerBackendConfig during workflow container setup.
Common situations: Copying a docker-style memory string ('512m', '1g') into the config; YAML unquoted strings staying strings; hand-tuning memory and typing a decimal; misreading the unit (the value is MiB, an integer).
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid container.network '${network}' in .archon/config.yam
- Invalid container.pidsLimit '${String(pidsLimit)}' — must be
- No chat in context
- Gitea API error: ${String(response.status)} ${response.statu
- Gitea API error: ${String(response.status)}
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/3137bd9df9517400.
Report an issue: GitHub.