# OpenCode: The user has specified a rule which prevents you from using this specific tool call.

> A rule under `permission` in opencode.json, or in an agent's frontmatter, denied this tool call, so OpenCode rejected it and returned this text plus the relevant rules to the model. The exact message, why OpenCode prints it, and the fix.

_Updated November 23, 2026_

## The message

```text
The user has specified a rule which prevents you from using this specific tool call.
```

## What it means

A rule under `permission` in opencode.json, or in an agent's frontmatter, denied this tool call, so OpenCode rejected it and returned this text plus the relevant rules to the model. OpenCode 1 matches rules by pattern and the last matching rule wins, so a catch-all placed after specific rules overrides them; that ordering is behind many 'permissions not working' reports. Rules from the OPENCODE_PERMISSION environment variable are merged in too, and can override the file's rules the same way.

## Fix

1. Put the catch-all "*" rule first and the more specific rules after it, because the last matching rule wins.
2. Check the effective rules with `opencode debug config` and `opencode debug agent <name>`.
3. Run `env | grep OPENCODE_PERMISSION`: that variable holds inline permission JSON, and a {"*":"allow"} in it showed up after the project's deny rules in `opencode debug config` and overrode them.
4. Remember that in OpenCode 1 `edit` covers the edit, write and patch tools.
5. On OpenCode 2, rules live in an ordered `permissions` array of { "action", "resource", "effect" } objects, `bash` becomes `shell`, and a blocked call reads 'Permission denied: <action>'.

## In an EnvHaven workspace

It can happen anywhere OpenCode runs; the fix above applies in a workspace too.

## Where this comes from

From OpenCode's documentation and issue tracker:

- [github.com/anomalyco/opencode/issues/10529](https://github.com/anomalyco/opencode/issues/10529)
- [github.com/anomalyco/opencode/blob/dev/services/site/src/docs/v1/content/permissions.mdx](https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/v1/content/permissions.mdx)
- [github.com/anomalyco/opencode/issues/7554#issuecomment-3735016804](https://github.com/anomalyco/opencode/issues/7554#issuecomment-3735016804)
- [github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/migrate-v1.mdx](https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/migrate-v1.mdx)

## Keep reading

- [OpenCode](https://envhaven.com/agents/opencode)
- [Is OpenCode down?](https://envhaven.com/status/opencode)
- [Every agent error](https://envhaven.com/errors)

Source: https://envhaven.com/errors/opencode/permission-rule-denied
