{"record":{"id":"86f62b9727bf47ab","repo":"can1357/oh-my-pi","slug":"url-reads-are-disabled-by-settings","errorCode":null,"errorMessage":"URL reads are disabled by settings.","messagePattern":"URL reads are disabled by settings\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"warning","filePath":"packages/coding-agent/src/tools/fetch.ts","lineNumber":1692,"sourceCode":"\t\t\tcontentType: result.contentType,\n\t\t\tmethod: result.method,\n\t\t\ttruncated: Boolean(result.truncated),\n\t\t\tnotes: result.notes,\n\t\t},\n\t\timage: result.image,\n\t\toutput,\n\t\tcontent: result.content,\n\t};\n}\n\n/** Materialize rendered URL body text to a local file for tools that require filesystem paths. */\nexport async function materializeReadUrlToFile(\n\tsession: ToolSession,\n\tparams: { path: string; raw?: boolean },\n\tsignal?: AbortSignal,\n): Promise<{ path: string; details: ReadUrlToolDetails }> {\n\tif (!session.settings.get(\"fetch.enabled\")) {\n\t\tthrow new ToolError(\"URL reads are disabled by settings.\");\n\t}\n\tconst entry = await fetchReadUrl(session, params, signal);\n\tconst contentPath = await materializeReadUrlContent(session, entry, params.raw ?? false);\n\treturn { path: contentPath, details: entry.details };\n}\n\nfunction buildUrlReadOutput(result: FetchRenderResult, content: string): string {\n\tlet output = \"\";\n\toutput += `URL: ${result.finalUrl}\\n`;\n\toutput += `Content-Type: ${result.contentType}\\n`;\n\toutput += `Method: ${result.method}\\n`;\n\tif (result.notes.length > 0) {\n\t\toutput += `Notes: ${result.notes.join(\"; \")}\\n`;\n\t}\n\toutput += `\\n---\\n\\n`;\n\toutput += content;\n\treturn output;\n}","sourceCodeStart":1674,"sourceCodeEnd":1710,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/fetch.ts#L1674-L1710","documentation":"The fetch tool refuses to read a URL when the `fetch.enabled` setting is false in the session settings. materializeReadUrlToFile checks this gate before calling fetchReadUrl, so any URL read attempt hits this guard when fetch is turned off. It is a deliberate configuration kill-switch, not a network failure.","triggerScenarios":"Calling materializeReadUrlToFile (or the read-url tool it backs) while session.settings.get(\"fetch.enabled\") is falsy — e.g. fetch disabled in project or global settings.","commonSituations":"Users with fetch disabled for security/compliance reasons; a prompt asks the agent to fetch a web page but config never enabled the fetch tool; settings file typo sets fetch.enabled to false or omits it with a default-off policy.","solutions":["Enable the setting: set \"fetch.enabled\": true in your opencode/coding-agent settings and retry.","If fetch should stay off, handle the ToolError and tell the user/prompt that URL reads are unavailable, or supply content another way (paste the page, use a local file).","Verify which settings scope (project vs global) is disabling fetch; remove the restrictive key if unintended."],"exampleFix":"// before (session with fetch disabled)\nawait materializeReadUrlToFile(session, { path: \"https://example.com\" });\n// after: enable in settings.json\n{ \"fetch\": { \"enabled\": true } }","handlingStrategy":"validation","validationCode":"if (!session.settings.get(\"fetch.enabled\")) {\n  // surface a friendly message or skip the URL step\n  return null;\n}\nreturn materializeReadUrlToFile(session, params, signal);","typeGuard":null,"tryCatchPattern":"try {\n  const { path, details } = await materializeReadUrlToFile(session, params, signal);\n} catch (err) {\n  if (err instanceof ToolError && err.message.includes(\"URL reads are disabled\")) {\n    // fall back to a local source or inform the user\n  } else throw err;\n}","preventionTips":["Check session.settings.get(\"fetch.enabled\") before invoking any URL-reading tool.","Document in your project config that fetch.enabled gates web access.","Provide non-network fallbacks (local files, pasted content) in environments with fetch disabled."],"tags":["settings","fetch","configuration"],"backgroundTag":"feature-disabled-by-settings","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}