santifer/career-ops · error · Error

the release pointer is not JSON

Error message

the release pointer is not JSON: ${url}

What it means

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.

Solutions

  1. Inspect what the URL returns: `curl -s <url> | head -20` — you will likely see HTML or an error message instead of JSON.
  2. If behind a proxy/captive portal, authenticate or switch networks, then re-run.
  3. Correct the pointer URL to the raw JSON endpoint (e.g. raw.githubusercontent.com, not github.com blob page).
  4. Retry later if the upstream host is returning garbled responses during an incident.

Example fix

// before
curl -s "$POINTER_URL" | head -3   # <!DOCTYPE html> ... login page
// after
# authenticate to the network/proxy, then
node plugins/h1b-sponsor/install-h1b-index.mjs
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(pointerUrl);
const text = await res.text();
let doc;
try { doc = JSON.parse(text); }
catch { throw new Error(`pointer is not JSON (got: ${text.slice(0, 80)}...)`); }

Type guard

null

Try / catch

try {
  await installH1bIndex();
} catch (e) {
  if (e.message.includes('release pointer is not JSON')) {
    console.error('Fetch the pointer URL manually — you are probably behind a captive portal/proxy or the URL points at an HTML page.');
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/99b3664cd6abe959. Report an issue: GitHub.

Appendix: source

Thrown at plugins/h1b-sponsor/install-h1b-index.mjs:115

 * streams to disk instead.
 *
 * Both fields are validated before use. They come from the network, and one of
 * them is about to become part of a URL and the other the sole thing standing
 * between a substituted download and a lookup that trusts it.
 */
async function fetchPointer(fetchImpl, url) {
  const out = await fetchImpl(url, { timeoutMs: POINTER_TIMEOUT_MS }, async res => {
    if (res.status !== 200) return { status: res.status };
    const read = await readBoundedText(res, MAX_POINTER_BYTES);
    return read.oversized ? { oversized: true } : { text: read.text };
  });
  if (out.status) throw new Error(`could not read the release pointer (HTTP ${out.status}): ${url}`);
  if (out.oversized) throw new Error(`the release pointer is implausibly large: ${url}`);

  let doc;
  try {
    doc = JSON.parse(String(out.text || ''));
  } catch {
    throw new Error(`the release pointer is not JSON: ${url}`);
  }
  if (!doc || typeof doc !== 'object') throw new Error(`the release pointer is not an object: ${url}`);

  const filename = String(doc.filename || '');
  if (!FILENAME_RE.test(filename)) {
    throw new Error(`the release pointer names an unusable index filename (${JSON.stringify(doc.filename)}): ${url}`);
  }
  const sha256 = String(doc.sha256 || '').trim().toLowerCase();
  if (!SHA256_RE.test(sha256)) {
    throw new Error(`the release pointer does not carry a sha256 digest: ${url}`);
  }
  // Recorded, never acted on, so a missing or odd value costs a label rather
  // than the install. Bounded because it lands in a file on disk.
  const version = doc.version === undefined || doc.version === null
    ? null
    : String(doc.version).slice(0, 64);
  return { filename, sha256, version };

View on GitHub (pinned to aac998c7ed)