Skip to content

[Bug] Windows path references and permissions on external directory path not working #36681

Closed as not planned

Description

@m21-cerutti

Description

Hello,

I tried to configure my opencode with windows path but it is not working, and there is no documentation of how you would handle path on windows.

Here my configuration :

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "external_directory": {
      "~/.config/opencode/**": "allow",
      "$HOME/.config/opencode/**": "allow",
      "C:\\Users\\User\\.config\\opencode": "allow",
      "C:\\Projects\\AI\\lm-studio-assistant": "allow",
    },
  },
  "references": {
    "global-config": {
      "path": "~/.config/opencode",
      "description": "Global config folder for opencode.",
    },
    "lm-studio-assistant": {
      "path": "C:\\Projects\\AI\\lm-studio-assistant",
      "description": "LM Studio assistant project.",
    },
  }
}

But when inspecting logs:

timestamp=2026-07-13T13:58:14.712Z level=INFO run=7ae11f63 message=asking id=per_f5bc573b8001VMtIrmKNCaFDdL permission=external_directory patterns="[\"C:\\\\Projects\\\\AI\\\\lm-studio-assistant\\\\*\"]"

There is confusion from if ~/ would work on windows first (and so $HOME)

Possibilities could be :
"/c/Projects/AI/lm-studio-assistant"
"/mnt/c/Projects/AI/lm-studio-assistant" (WSL)
"C:\\Projects\\AI\\lm-studio-assistant"
"C:/Projects/AI/lm-studio-assistant" (mic mac ?)
"C:\\\\Projects\\\AI\\\\lm-studio-assistant" (from logs)

I would expect automatic handling of windows paths to detect unix windows convention (C:\\Users, /c/Projects) or at least document it.

Plugins

None

OpenCode version

1.17.18

Steps to reproduce

  1. Set a new project with opencode.jsonc
  2. Ask to search files and verify paths on others projects listed on references
  3. Permission to explore is asked.

Screenshot and/or share link

On a subagent researcher, but would have the same problem with default agents (no override on external directory permissions)
Image

Agent permissions:

---
description: Read-only research librarian — extracts facts from project files and the web, cross-references sources, every fact cited — outputs a three-part report (facts, cross-references, gaps)
mode: all
temperature: 0.3
color: info
permission:
  edit: deny
  read: allow
  glob: allow
  grep: allow
  webfetch: allow
  websearch: allow
  task: deny
  bash:
    '*': deny
    'echo *': 'allow'
    'ls *': 'allow'
    'dir *': 'allow'
    'cat *': 'allow'
    'head *': 'allow'
    'tail *': 'allow'
    'wc *': 'allow'
    'find *': 'allow'
    'grep *': 'allow'
    'rg *': 'allow'
    'diff *': 'allow'
    'file *': 'allow'
    'rg *': allow
    'Get-Content*': 'allow',
    'Get-ChildItem*': 'allow',
    'Get-Item*': 'allow',
    'Select-String*': 'allow',
    'Test-Path*': 'allow',
---

Operating System

Windows 11 25H2 26200.8655

Terminal

OpenCode desktop

Causes

Seems external_directory is not cumulative with home configuration.
see #36681 (comment)

#36681 (comment) is a point on unclear documentation with references.
And there is others problems after that.

Activity

  1. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. m21-cerutti commented on Jul 13, 2026

    @m21-cerutti
    Author

    Also one point not in original issue, references and external_directory collide and is not clear on usage, if we make a reference but deny autorisations what would be the result and use case ? For now it's an "ask" permission but not very clear of why.

    Image
  3. m21-cerutti commented on Jul 13, 2026

    @m21-cerutti
    Author

    It seems permissions for external_directory (https://opencode.ai/docs/permissions/#external-directories) is not working at all, would expect the read to fail or have an error, not asking since all external_directory path are denied.

    Image

    EDIT: seems the inverse is also true

    Image

    Possible hint, my opencode.jsonc in home ask for permission.

  4. m21-cerutti commented on Jul 13, 2026

    @m21-cerutti
    Author

    Seems external_directory is not cumulative with home configuration.
    Having commented the corresponding section in ~.config\opencode\ make at least wilcard working

    It contradicts documentation :

    Configuration files are merged together, not replaced.

    https://opencode.ai/docs/config/#locations

    Image

    Work also on deny but seems maybe confused with references permissions

    Image

    Others working examples:

    Image Image

    See the convention working is
    C:\\Users
    and not
    /c/Users/

    Image Image
  5. m21-cerutti commented on Jul 13, 2026

    @m21-cerutti
    Author

    But touch permission not follow permissions for external directory (would be denied or allow, not ask)

    Image

    Same for Glob

    Image
  6. m13v commented on Jul 14, 2026

    @m13v

    the allow-list patterns read correct, but that's not what the runtime checks them against. your log shows it prompting on "C:\Projects\AI\lm-studio-assistant\*", a normalized + globbed form your literal external_directory entry never string-matches. so a fully-specified block still asks. and since external_directory isn't cumulative with the home config, the ~/.config allows quietly drop at the same time. the gate isn't the policy text you wrote, it's the path-normalization pass it gets compared against, and that pass is exactly what the config can't show you.

  7. m21-cerutti commented on Aug 17, 2026

    @m21-cerutti
    Author

    Seems it have been improve with last versions of opencode, but still lack documentation for windows in https://opencode.ai/docs/permissions/.

  8. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions