nanocoai/nanoclaw · error · Error

Provide --host <host-path> and --container <container-path>

Error message

Provide --host <host-path> and --container <container-path>

What it means

Thrown by `ncl groups config add-mount` when either the host path or container path is missing. The handler accepts `--host`/`--host-path` and `--container`/`--container-path` aliases but requires both to be non-empty before building the `AdditionalMountConfig` object.

Source

Thrown at src/cli/resources/groups.ts:567

        return {
          removed: { apt: apt || null, npm: npm || null },
          note: 'Image rebuild required for package changes to take effect.',
        };
      },
    },
    'config add-mount': {
      access: 'approval',
      hostOnly: true,
      description:
        "Mount a host directory into a group's containers. OPERATOR-ONLY — never runnable from " +
        'inside a container (mounting host paths is a filesystem-access boundary). Requires ' +
        '`ncl groups restart` to take effect. Use --id <group-id> --host <host-path> --container <container-path> [--ro].',
      handler: async (args) => {
        const id = args.id as string;
        if (!id) throw new Error('--id is required');
        const hostPath = (args.host ?? args['host-path']) as string | undefined;
        const containerPath = (args.container ?? args['container-path']) as string | undefined;
        if (!hostPath || !containerPath) throw new Error('Provide --host <host-path> and --container <container-path>');

        const row = await getContainerConfig(id);
        if (!row) throw new Error(`No container config for group: ${id}`);

        const mount: AdditionalMountConfig = {
          hostPath,
          containerPath,
          ...(args.ro || args.readonly ? { readonly: true } : {}),
        };
        const existing = JSON.parse(row.additional_mounts) as AdditionalMountConfig[];
        if (!existing.some((m) => m.hostPath === hostPath && m.containerPath === containerPath)) {
          existing.push(mount);
          await updateContainerConfigJson(id, 'additional_mounts', existing);
        }
        return { added: mount, note: `Run \`ncl groups restart --id ${id}\` for the mount to take effect.` };
      },
    },
    'config remove-mount': {

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Supply both flags: `--host <host-path> --container <container-path>`
  2. If scripting, assert both variables are set and non-empty before invoking

Example fix

# before
ncl groups config add-mount --id my-group --host /srv/data
# after
ncl groups config add-mount --id my-group --host /srv/data --container /data
Defensive patterns

Strategy: validation

Validate before calling

if (!hostPath || !containerPath) { console.error('both --host and --container are required'); process.exit(1); }

Type guard

const isMountArgs = (a: Record<string, unknown>): a is { host: string; container: string } => typeof a.host === 'string' && typeof a.container === 'string' && a.host !== '' && a.container !== '';

Prevention

When it happens

Trigger: `ncl groups config add-mount --id <g> --host /srv/data` (no --container), or the reverse, or empty-string values for either flag.

Common situations: Assuming the container path defaults to the host path; typos like `--hostpath` that fall into args['host-path'] but with wrong casing; script variables that are unset.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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