{"record":{"id":"316120d99aabe8a4","repo":"can1357/oh-my-pi","slug":"url-reads-are-disabled-by-settings-316120","errorCode":null,"errorMessage":"URL reads are disabled by settings.","messagePattern":"URL reads are disabled by settings\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/read.ts","lineNumber":1118,"sourceCode":"\t\t\t}\n\t\t\treadPath = attachment.sourcePath;\n\t\t}\n\n\t\tconst conflictUri = parseConflictUri(readPath);\n\t\tif (conflictUri) {\n\t\t\tif (conflictUri.id === \"*\") {\n\t\t\t\tthrow new ToolError(\n\t\t\t\t\t\"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.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn this.#readConflictRegion(conflictUri.id, conflictUri.scope);\n\t\t}\n\t\tconst displayMode = resolveFileDisplayMode(this.session);\n\n\t\tconst parsedUrlTarget = parseReadUrlTarget(readPath);\n\t\tif (parsedUrlTarget) {\n\t\t\tif (!this.session.settings.get(\"fetch.enabled\")) {\n\t\t\t\tthrow new ToolError(\"URL reads are disabled by settings.\");\n\t\t\t}\n\t\t\tconst urlRaw = parsedUrlTarget.raw;\n\t\t\tconst urlRanges = parsedUrlTarget.ranges;\n\t\t\tif (urlRanges !== undefined && urlRanges.length > 1) {\n\t\t\t\tconst entry = await fetchReadUrl(this.session, { path: parsedUrlTarget.path, raw: urlRaw }, signal, {\n\t\t\t\t\tensureArtifact: true,\n\t\t\t\t});\n\t\t\t\treturn buildInMemoryMultiRangeResult(this.session, entry.output, urlRanges, {\n\t\t\t\t\tdetails: { ...entry.details },\n\t\t\t\t\tsourceUrl: entry.details.finalUrl,\n\t\t\t\t\tentityLabel: \"URL output\",\n\t\t\t\t\traw: urlRaw,\n\t\t\t\t\timmutable: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst urlOffset = parsedUrlTarget.offset;\n\t\t\tconst urlLimit = parsedUrlTarget.limit;\n\t\t\tif (urlOffset !== undefined || urlLimit !== undefined) {","sourceCodeStart":1100,"sourceCodeEnd":1136,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/read.ts#L1100-L1136","documentation":"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.","triggerScenarios":"read('https://example.com') or a URL with line ranges while session.settings.get('fetch.enabled') === false.","commonSituations":"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.","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."],"exampleFix":"// before: opencode.json\n{ \"fetch\": { \"enabled\": false } }\n// after\n{ \"fetch\": { \"enabled\": true } }","handlingStrategy":"validation","validationCode":"// check the gate before attempting a URL read\nconst fetchEnabled = session.settings.get('fetch.enabled');\nif (!fetchEnabled && /^https?:\\/\\//.test(target)) {\n  throw new Error(`URL reads disabled; enable fetch.enabled or fetch ${target} out-of-band`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await readTool.execute({ path: url });\n} catch (e) {\n  if (e instanceof ToolError && e.message === 'URL reads are disabled by settings.') {\n    // fall back: download manually and read the local file\n    await $`curl -fsSL ${url} -o /tmp/page.html`;\n    return readTool.execute({ path: '/tmp/page.html' });\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["settings","url","fetch","permissions"],"backgroundTag":"feature-disabled-by-settings","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}