nanocoai/nanoclaw · critical · Error

Container config not found for agent group: ${agentGroupId}

Error message

Container config not found for agent group: ${agentGroupId}

What it means

materializeContainerJson found the agent group but no row in container_configs for it. Normally backfill-container-configs.ts creates a default row at startup, so a missing row means the backfill was skipped, the row was deleted, or the group was created outside the normal path.

Source

Thrown at src/container-config.ts:388

    maxMessagesPerPrompt: row.max_messages_per_prompt ?? undefined,
    model: row.model ?? undefined,
    effort: row.effort ?? undefined,
    timezone: row.timezone && isValidTimezone(row.timezone) ? row.timezone : undefined,
    runtimeTier: parseRuntimeTier(row.runtime_tier, group.name),
  };
}

/**
 * Materialize `container.json` from the DB. Called at spawn time so the
 * container always sees fresh config. Returns the `ContainerConfig` for
 * use by the caller (buildMounts, composeSessionSpec, etc.).
 */
export async function materializeContainerJson(agentGroupId: string): Promise<ContainerConfig> {
  const group = await getAgentGroup(agentGroupId);
  if (!group) throw new Error(`Agent group not found: ${agentGroupId}`);

  const row = await getContainerConfig(agentGroupId);
  if (!row) throw new Error(`Container config not found for agent group: ${agentGroupId}`);

  const config = configFromDb(row, group);

  const p = path.join(GROUPS_DIR, group.folder, 'container.json');
  const dir = path.dirname(p);
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
  fs.writeFileSync(p, JSON.stringify(config, null, 2) + '\n');

  return config;
}

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Restart the host (pnpm run dev / systemctl --user restart nanoclaw) so backfill creates the default row
  2. Or insert one programmatically via the createContainerConfig path / ncl groups config update
  3. If migrations were skipped, run them, then restart
  4. Check logs/nanoclaw.error.log for a failed backfill
Defensive patterns

Strategy: fallback

Validate before calling

let row = await getContainerConfig(agentGroupId); if (!row) { row = await createDefaultContainerConfig(agentGroupId); } // or trigger backfill

Try / catch

try { await materializeContainerJson(id); } catch (err) { if (err.message.includes('Container config not found')) { await runBackfill(); return await materializeContainerJson(id); } throw err; }

Prevention

When it happens

Trigger: Group created by direct DB insert without a container_configs row; container_configs row deleted manually; startup backfill (backfill-container-configs.ts) failed or hasn't run yet after adding a group.

Common situations: Manual DB seeding during migration testing; an old install upgraded without running migrations; deleting the config row to 'reset' it.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/47f805386ab8f160. Report an issue: GitHub.