santifer/career-ops · error · Error

the release pointer is not an object

Error message

the release pointer is not an object: ${url}

What it means

After successfully JSON-parsing the release pointer, the installer verifies the result is a non-null object (typeof 'object'). Values like arrays, numbers, strings, or literal null pass JSON.parse but fail this check, so the installer throws rather than dereferencing doc.filename blindly.

Solutions

  1. Check the URL's content with `curl -s <url>`; confirm it is a JSON object with `filename` and `sha256` fields.
  2. Fix the pointer URL to point at the pointer document, not a releases list or other JSON.
  3. If you run a mirror, update it to serve the expected pointer object shape `{"filename":..., "sha256":..., "version":...}`.

Example fix

// before
curl -s "$POINTER_URL"   # [ {"filename": ...}, ... ]  (array)
// after
curl -s "$POINTER_URL"   # {"filename":"h1b-index.sqlite.zst","sha256":"..."}
Defensive patterns

Strategy: type-guard

Validate before calling

const doc = JSON.parse(text);
if (doc === null || typeof doc !== 'object' || Array.isArray(doc)) {
  throw new TypeError('pointer must be a JSON object');
}

Type guard

const isPointerObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v) && typeof v.filename === 'string' && typeof v.sha256 === 'string';

Try / catch

try {
  await installH1bIndex();
} catch (e) {
  if (e.message.includes('release pointer is not an object')) {
    console.error(`Pointer at ${e.message.split(': ').pop()} is not a JSON object — verify the URL targets the pointer document.`);
  } else throw e;
}

Prevention

When it happens

Trigger: Running install-h1b-index.mjs when the pointer URL serves valid JSON that is not an object: a bare JSON array ([...]), a quoted string, a number, or the JSON literal null — usually because the URL points at the wrong file or an API listing endpoint.

Common situations: Pointer URL accidentally pointing at a JSON array of releases from an API endpoint; a renamed/moved pointer file leaving an index-style JSON at the URL; hand-rolled mirror serving the wrong document.

Related errors


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

Appendix: source

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

 * 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)