can1357/oh-my-pi · error · Error

--host-network is docker-only (compose overlay)

Error message

--host-network is docker-only (compose overlay)

What it means

After parsing, the runner cross-validates flag combinations: --host-network maps Docker's compose host networking and has no equivalent under the apple-container (vmnet) environment, so specifying it together with --environment apple-container throws. This is a semantic (cross-flag) validation, not a parse error.

Source

Thrown at packages/metaharness/src/runner.ts:367

					cfg.env[spec.slice(0, eq2)] = spec.slice(eq2 + 1);
				}
				break;
			}
			case "--environment": {
				const v = take(arg);
				if (v !== "docker" && v !== "apple-container") {
					throw new Error("--environment must be docker|apple-container");
				}
				cfg.envType = v;
				break;
			}
			default:
				throw new Error(`unknown flag: ${arg} (see --help)`);
		}
	}
	if (cfg.models.length === 0) cfg.models = ["anthropic/claude-sonnet-4-6"];
	if (cfg.envType === "apple-container") {
		if (cfg.hostNetwork) throw new Error("--host-network is docker-only (compose overlay)");
		// host.docker.internal doesn't exist on vmnet; containers reach the host at the bridge address.
		if (cfg.gatewayUrl === DOCKER_GATEWAY_URL) cfg.gatewayUrl = VMNET_GATEWAY_URL;
	}
	return cfg;
}

// ─────────────────────────────────────────────────────────────────── resume

/** manager.json launch record written by RunStore.registerLaunch. */
interface ManagerRecord {
	benchmark?: string;
	dataset?: string;
	config?: LaunchRequest;
}

/**
 * Recover the original launch Config for `--resume <job>` — nothing needs
 * re-specifying. Prefers the exact Config snapshot recorded at launch

View on GitHub (pinned to 9690622007)

Solutions

  1. Remove --host-network when using --environment apple-container.
  2. Switch back to --environment docker if you actually need host networking (compose overlay).
  3. If resuming, edit the job's saved config or pass flags that don't conflict with the resumed environment type.
  4. Adjust your wrapper script to only add --host-network when ENV=docker.

Example fix

// before
runner --environment apple-container --host-network
// after
runner --environment apple-container
Defensive patterns

Strategy: validation

Validate before calling

if (environment === "apple-container" && hostNetwork) {
  throw new Error("--host-network is only valid with --environment docker");
}

Try / catch

try {
  await runHarness({ environment, hostNetwork });
} catch (e) {
  if (e instanceof Error && e.message.includes("--host-network is docker-only")) {
    console.error("Drop --host-network or switch to --environment docker.");
  } else throw e;
}

Prevention

When it happens

Trigger: `runner --environment apple-container --host-network` — either explicitly or because a saved runner-config for a resumed job contains hostNetwork=true while the user overrides the environment.

Common situations: Switching an existing docker-based job config to apple-container without removing --host-network; scripts that always append --host-network; copying a docker invocation and only changing the environment flag.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/1416253d18dcf71a. Report an issue: GitHub.