can1357/oh-my-pi · error

Could not create log directories: ${logDirs.stderr.trim()}

Error message

Could not create log directories: ${logDirs.stderr.trim()}

What it means

runTrial in the trial-bench harness creates /logs/agent and /logs/verifier inside the VM before starting the agent. This error is thrown when the `mkdir -p /logs/agent /logs/verifier` command run via vm.exec returns a non-zero exit code; the command's trimmed stderr is embedded so the developer can see why mkdir failed.

Source

Thrown at packages/metaharness/src/tb/trial.ts:136

			TrialVm.start({
				config: opts.vmon,
				image: opts.task.image,
				name: vmName,
				cpus: opts.task.cpus,
				memoryMb: opts.task.memoryMb,
				storageMb: opts.task.storageMb,
				timeoutSec: Math.ceil(deadlineMs / 1_000),
				env: opts.task.environmentEnv,
			}),
		);
		checkDeadline();

		opts.log?.("connect gateway");
		const gatewayUrl = await beforeDeadline(vm.startGateway(opts.gateway.url));
		opts.log?.("install agent");
		const entrypoint = await beforeDeadline(installAgent(vm, opts.binaries, { ...opts.gateway, url: gatewayUrl }));
		const logDirs = await vm.exec("mkdir -p /logs/agent /logs/verifier");
		if (logDirs.exitCode !== 0) throw new Error(`Could not create log directories: ${logDirs.stderr.trim()}`);
		checkDeadline();

		const { provider, model } = modelParts(opts.model);
		client = new RpcClient({
			spawn: vm.rpcTransport(entrypoint, opts.task.agentTimeoutSec + 30),
			provider,
			model,
			args: ["--no-session", "--auto-approve", "--tools", TERMINAL_BENCH_TOOLS],
		});
		let turns = 0;
		const unsubscribe = client.onEvent(event => {
			if (event.type === "turn_start") turns++;
		});
		let agentCollectionError: string | null = null;
		const agentStartedAt = performance.now();
		try {
			await client.start();
			opts.log?.("prompt");

View on GitHub (pinned to 9690622007)

Solutions

  1. Check the embedded stderr in the message to identify the exact mkdir failure cause
  2. Verify the VM image includes mkdir (busybox/coreutils) and / is writable
  3. Free disk space or expand the guest volume if the error indicates ENOSPC
  4. Pre-bake the /logs directories into the VM image or snapshot so mkdir is a no-op

Example fix

// before
await vm.exec("mkdir -p /logs/agent /logs/verifier");
// after: bake into image or use a writable location
await vm.exec("mkdir -p /tmp/logs/agent /tmp/logs/verifier");
Defensive patterns

Strategy: try-catch

Validate before calling

const probe = await vm.exec("mkdir -p /logs/agent /logs/verifier");
if (probe.exitCode !== 0) {
  const df = await vm.exec("df -h /");
  throw new Error(`Guest mkdir failed: ${probe.stderr.trim()}\n${df.stdout}`);
}

Try / catch

try {
  await runTrial(opts);
} catch (err) {
  if (String(err.message).startsWith("Could not create log directories")) {
    // recreate the VM with a writable, disk-healthy image
    await recreateVmAndRetry(opts);
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling runTrial when the VM guest filesystem cannot create /logs: read-only root filesystem, full disk, missing mkdir binary in the guest image, or the exec transport itself failing to run the command.

Common situations: Running trials against minimal VM/container images without coreutils at /bin/mkdir; mounting / read-only; guest disk quota exhausted after many trial runs.

Related errors


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