{"record":{"id":"17235ff861fe00e2","repo":"jackwener/OpenCLI","slug":"medium-tag-request-failed-err-message-err","errorCode":null,"errorMessage":"medium tag request failed: ${err?.message ?? err}","messagePattern":"medium tag request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/medium/tag.js","lineNumber":104,"sourceCode":"        { name: 'tag', positional: true, required: true, help: 'Lowercase tag slug (e.g. \"programming\", \"machine-learning\")' },\n        { name: 'limit', type: 'int', default: 20, help: 'Max articles (1-25 — single RSS page)' },\n    ],\n    columns: ['rank', 'title', 'author', 'description', 'categories', 'published', 'url'],\n    func: async (args) => {\n        const tag = requireTag(args.tag);\n        const limit = requireBoundedInt(args.limit, 20, 25);\n        const url = `https://medium.com/feed/tag/${tag}`;\n        let resp;\n        try {\n            resp = await fetch(url, {\n                headers: {\n                    'user-agent': 'opencli-medium-adapter (+https://github.com/jackwener/opencli)',\n                    accept: 'application/rss+xml, application/xml',\n                },\n            });\n        }\n        catch (err) {\n            throw new CommandExecutionError(\n                `medium tag request failed: ${err?.message ?? err}`,\n                'Check that medium.com is reachable from this network.',\n            );\n        }\n        if (resp.status === 404) {\n            throw new EmptyResultError('medium tag', `Medium tag \"${tag}\" does not exist.`);\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`medium tag returned HTTP ${resp.status}`);\n        }\n        const xml = await resp.text();\n        const items = [];\n        const re = /<item[^>]*>([\\s\\S]*?)<\\/item>/g;\n        let m;\n        while ((m = re.exec(xml)) !== null) {\n            items.push(m[1]);\n        }\n        if (!items.length) {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/medium/tag.js#L86-L122","documentation":"When the HTTP request to Medium's tag RSS feed throws (DNS failure, connection refused, timeout, TLS error), the adapter wraps the underlying message in CommandExecutionError prefixed 'medium tag request failed:'. It distinguishes network-level failure from HTTP status errors handled afterwards.","triggerScenarios":"Calling `medium tag <tag>` while offline, behind a proxy/firewall blocking medium.com, with DNS misconfiguration, or when Medium is unreachable/down so fetch itself rejects.","commonSituations":"Corporate networks blocking medium.com; VPN interference; Docker containers without outbound internet; typo'd DNS or IPv6 issues; Medium outages.","solutions":["Verify connectivity: curl -I https://medium.com/feed/tag/programming from the same machine.","Check proxy/firewall/VPN settings and set HTTPS_PROXY if your network requires one.","Retry after confirming status.medium.com or Medium itself is not down.","Run with the underlying err.message from the error text to pinpoint DNS vs TLS vs timeout and fix accordingly."],"exampleFix":"// before (blocked network)\nmedium tag programming   # -> medium tag request failed: getaddrinfo ENOTFOUND medium.com\n// after (configure proxy)\nexport HTTPS_PROXY=http://proxy.corp.local:8080\nmedium tag programming","handlingStrategy":"retry","validationCode":"// preflight: abort early if medium.com is unreachable\nconst ctrl = new AbortController();\nconst t = setTimeout(() => ctrl.abort(), 5000);\ntry {\n  await fetch('https://medium.com/feed/tag/programming', { signal: ctrl.signal });\n} finally { clearTimeout(t); }","typeGuard":null,"tryCatchPattern":"try {\n  await run(['medium', 'tag', tag]);\n} catch (e) {\n  if (/medium tag request failed:/.test(e.message)) {\n    console.error('Network issue reaching medium.com; check DNS/proxy/VPN');\n    await sleep(2000); // then retry\n  } else throw e;\n}","preventionTips":["Check outbound connectivity to medium.com before running batch jobs.","Configure HTTPS_PROXY in restricted/corporate networks.","Add exponential backoff around network-dependent CLI calls.","Monitor Medium's status page for outages before blaming local config."],"tags":["network","http","cli","command-execution-error"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}