Skip to content

YOLO mode file mount fails (--add-dir "Not a directory") #139

Open

Description

@lexx42xxel

When a mount's host path is a file rather than a directory (e.g. copilot_here --yolo  --mount /.copilot/mcp-config.json:/.copilot/mcp-config.json:rw , or the equivalent saved via  copilot_here mount ), YOLO mode still passes it to  copilot --add-dir :

// app/Commands/Run/RunCommand.cs (~line 605-617)
foreach (var mount in allMounts)
{
toolCommand.Add("--add-dir");
toolCommand.Add(mount.GetContainerPath(ctx.Paths.UserHome));
}

 MountEntry  ( app/Commands/Mounts/_MountsConfig.cs ) has no file/directory distinction, so this always fires regardless of mount type.  copilot 's CLI now enforces  --add-dir  must be a directory, so it fails with (since a few days):

error: option '--add-dir ' argument '/home/appuser/.copilot/mcp-config.json' is invalid. Not a directory: /home/appuser/.copilot/mcp-config.json

Repro:

copilot_here --yolo --mount /.copilot/mcp-config.json:/.copilot/mcp-config.json:rw

This used to work until a few days ago (probaly copilot update does not allow to pass file with "--add-dir" anymore)

Expected: File mounts work in YOLO mode. This matters for injecting single config files (e.g. shared MCP config into  ~/.copilot/mcp-config.json ) without mounting/sharing the whole  ~/.copilot  directory, which also holds session/auth/settings state the CLI writes to implicitly.

Workaround: copy files to be mounted to ~/.config/copilot-cli-docker/ , I guess the folder name depends on whether you enabled docker in your copilot_here instance or not.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions