can1357/oh-my-pi · error · ToolError
URL reads are disabled by settings.
Error message
URL reads are disabled by settings.
What it means
The Read tool can fetch URLs (parseReadUrlTarget), but this is gated by the 'fetch.enabled' setting. When the setting is false, any URL-shaped read target throws ToolError 'URL reads are disabled by settings.' — a policy error, not a network error; no request is attempted.
Source
Thrown at packages/coding-agent/src/tools/read.ts:1118
}
readPath = attachment.sourcePath;
}
const conflictUri = parseConflictUri(readPath);
if (conflictUri) {
if (conflictUri.id === "*") {
throw new ToolError(
"Reading `conflict://*` is not supported — wildcards are write-only. Use the `<path>:conflicts` read selector for the full list of conflicts in a file, or read `conflict://<N>` to inspect a single block.",
);
}
return this.#readConflictRegion(conflictUri.id, conflictUri.scope);
}
const displayMode = resolveFileDisplayMode(this.session);
const parsedUrlTarget = parseReadUrlTarget(readPath);
if (parsedUrlTarget) {
if (!this.session.settings.get("fetch.enabled")) {
throw new ToolError("URL reads are disabled by settings.");
}
const urlRaw = parsedUrlTarget.raw;
const urlRanges = parsedUrlTarget.ranges;
if (urlRanges !== undefined && urlRanges.length > 1) {
const entry = await fetchReadUrl(this.session, { path: parsedUrlTarget.path, raw: urlRaw }, signal, {
ensureArtifact: true,
});
return buildInMemoryMultiRangeResult(this.session, entry.output, urlRanges, {
details: { ...entry.details },
sourceUrl: entry.details.finalUrl,
entityLabel: "URL output",
raw: urlRaw,
immutable: true,
});
}
const urlOffset = parsedUrlTarget.offset;
const urlLimit = parsedUrlTarget.limit;
if (urlOffset !== undefined || urlLimit !== undefined) {View on GitHub (pinned to 9690622007)
Solutions
- Enable the setting: set "fetch": { "enabled": true } in settings (project or user opencode config).
- Ask the user/admin to enable it if settings are managed.
- Fetch the content yourself outside the tool (curl/browser) and paste or save it to a local file to read.
- Use an MCP/web-search tool if one is configured instead of URL reads.
Example fix
// before: opencode.json
{ "fetch": { "enabled": false } }
// after
{ "fetch": { "enabled": true } } Defensive patterns
Strategy: validation
Validate before calling
// check the gate before attempting a URL read
const fetchEnabled = session.settings.get('fetch.enabled');
if (!fetchEnabled && /^https?:\/\//.test(target)) {
throw new Error(`URL reads disabled; enable fetch.enabled or fetch ${target} out-of-band`);
} Try / catch
try {
return await readTool.execute({ path: url });
} catch (e) {
if (e instanceof ToolError && e.message === 'URL reads are disabled by settings.') {
// fall back: download manually and read the local file
await $`curl -fsSL ${url} -o /tmp/page.html`;
return readTool.execute({ path: '/tmp/page.html' });
}
throw e;
} Prevention
- Confirm 'fetch.enabled' is true in the active settings scope before planning URL reads.
- In managed environments, ask the admin to enable fetch rather than fighting the setting.
- Route web content through an MCP/web tool if fetch stays disabled.
- Cache fetched pages locally so later reads use plain file paths.
When it happens
Trigger: read('https://example.com') or a URL with line ranges while session.settings.get('fetch.enabled') === false.
Common situations: Fresh installs where network fetch is off by default; hardened/enterprise configs disabling outbound fetch; users unaware the feature is opt-in; managed settings.json pushed by an admin.
Related errors
- Settings config is invalid and could not be moved aside: ${f
- Failed to read settings config ${filePath}: ${String(result.
- URL reads are disabled by settings.
- {}: {error}
- inter-device move failed: {} to {}; unable to remove target:
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/316120d99aabe8a4.
Report an issue: GitHub.