{"record":{"id":"99b3664cd6abe959","repo":"santifer/career-ops","slug":"the-release-pointer-is-not-json-url","errorCode":null,"errorMessage":"the release pointer is not JSON: ${url}","messagePattern":"the release pointer is not JSON: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/h1b-sponsor/install-h1b-index.mjs","lineNumber":115,"sourceCode":" * streams to disk instead.\n *\n * Both fields are validated before use. They come from the network, and one of\n * them is about to become part of a URL and the other the sole thing standing\n * between a substituted download and a lookup that trusts it.\n */\nasync function fetchPointer(fetchImpl, url) {\n  const out = await fetchImpl(url, { timeoutMs: POINTER_TIMEOUT_MS }, async res => {\n    if (res.status !== 200) return { status: res.status };\n    const read = await readBoundedText(res, MAX_POINTER_BYTES);\n    return read.oversized ? { oversized: true } : { text: read.text };\n  });\n  if (out.status) throw new Error(`could not read the release pointer (HTTP ${out.status}): ${url}`);\n  if (out.oversized) throw new Error(`the release pointer is implausibly large: ${url}`);\n\n  let doc;\n  try {\n    doc = JSON.parse(String(out.text || ''));\n  } catch {\n    throw new Error(`the release pointer is not JSON: ${url}`);\n  }\n  if (!doc || typeof doc !== 'object') throw new Error(`the release pointer is not an object: ${url}`);\n\n  const filename = String(doc.filename || '');\n  if (!FILENAME_RE.test(filename)) {\n    throw new Error(`the release pointer names an unusable index filename (${JSON.stringify(doc.filename)}): ${url}`);\n  }\n  const sha256 = String(doc.sha256 || '').trim().toLowerCase();\n  if (!SHA256_RE.test(sha256)) {\n    throw new Error(`the release pointer does not carry a sha256 digest: ${url}`);\n  }\n  // Recorded, never acted on, so a missing or odd value costs a label rather\n  // than the install. Bounded because it lands in a file on disk.\n  const version = doc.version === undefined || doc.version === null\n    ? null\n    : String(doc.version).slice(0, 64);\n  return { filename, sha256, version };","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/plugins/h1b-sponsor/install-h1b-index.mjs#L97-L133","documentation":"The installer parses the downloaded release pointer as JSON; if JSON.parse fails it throws 'the release pointer is not JSON', naming the URL. This means the endpoint returned content that is not valid JSON — typically an HTML error page, an empty body, or a text/plain message.","triggerScenarios":"Running install-h1b-index.mjs when the pointer URL responds 200 but with non-JSON content: an HTML error/consent page from a proxy or captive portal, a rate-limit text message, a truncated body, or a URL pointing at a README instead of the pointer file.","commonSituations":"Corporate proxy or Wi-Fi captive portal serving an HTML login page with status 200; GitHub raw URL typo pointing to the repo page (HTML) rather than raw content; server-side incident returning error text with 200.","solutions":["Inspect what the URL returns: `curl -s <url> | head -20` — you will likely see HTML or an error message instead of JSON.","If behind a proxy/captive portal, authenticate or switch networks, then re-run.","Correct the pointer URL to the raw JSON endpoint (e.g. raw.githubusercontent.com, not github.com blob page).","Retry later if the upstream host is returning garbled responses during an incident."],"exampleFix":"// before\ncurl -s \"$POINTER_URL\" | head -3   # <!DOCTYPE html> ... login page\n// after\n# authenticate to the network/proxy, then\nnode plugins/h1b-sponsor/install-h1b-index.mjs","handlingStrategy":"validation","validationCode":"const res = await fetch(pointerUrl);\nconst text = await res.text();\nlet doc;\ntry { doc = JSON.parse(text); }\ncatch { throw new Error(`pointer is not JSON (got: ${text.slice(0, 80)}...)`); }","typeGuard":"null","tryCatchPattern":"try {\n  await installH1bIndex();\n} catch (e) {\n  if (e.message.includes('release pointer is not JSON')) {\n    console.error('Fetch the pointer URL manually — you are probably behind a captive portal/proxy or the URL points at an HTML page.');\n  } else throw e;\n}","preventionTips":["Use raw content URLs (raw.githubusercontent.com), not HTML blob pages.","Authenticate to captive portals before running installers.","Validate the endpoint returns application/json with a quick curl check."],"tags":["network","json","install"],"backgroundTag":"json-parse-error","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}