{"record":{"id":"8d38710c0b630852","repo":"angular/angular-cli","slug":"relative-pointer-pointer","errorCode":null,"errorMessage":"Relative pointer: ${pointer}","messagePattern":"Relative pointer: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/core/src/json/schema/pointer.ts","lineNumber":31,"sourceCode":"    fragments\n      .map((f) => {\n        return f.replace(/~/g, '~0').replace(/\\//g, '~1');\n      })\n      .join('/')) as JsonPointer;\n}\nexport function joinJsonPointer(root: JsonPointer, ...others: string[]): JsonPointer {\n  if (root == '/') {\n    return buildJsonPointer(others);\n  }\n\n  return (root + buildJsonPointer(others)) as JsonPointer;\n}\nexport function parseJsonPointer(pointer: JsonPointer): string[] {\n  if (pointer === '') {\n    return [];\n  }\n  if (pointer.charAt(0) !== '/') {\n    throw new Error('Relative pointer: ' + pointer);\n  }\n\n  return pointer\n    .substring(1)\n    .split(/\\//)\n    .map((str) => str.replace(/~1/g, '/').replace(/~0/g, '~'));\n}\n","sourceCodeStart":13,"sourceCodeEnd":39,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/core/src/json/schema/pointer.ts#L13-L39","documentation":"parseJsonPointer parses RFC 6901-style JSON pointers, which must be absolute — every pointer starts with '/'. Passing a pointer that doesn't begin with '/' (or any non-empty non-absolute string) is rejected with 'Relative pointer: <pointer>'. An empty string is valid and resolves to the root.","triggerScenarios":"Calling parseJsonPointer('foo'), parseJsonPointer('a/b'), or a value built by joining segments without a leading slash; passing a relative reference resolved against a base document instead of an absolute pointer.","commonSituations":"Hand-written pointers missing the leading slash, code concatenating property names like `${parent}/${key}` where parent is empty, JSON Schema $ref handling that receives relative refs, schema utility code (get/merge on JSON schema) fed user input.","solutions":["Prefix the pointer with '/': parseJsonPointer('/foo/bar')","Build pointers from segments: '/' + segments.map(escape).join('/') where escape replaces ~ with ~0 and / with ~1","Use '' (empty string) when you mean the document root"],"exampleFix":"// before\nparseJsonPointer('properties/name')\n// after\nparseJsonPointer('/properties/name')","handlingStrategy":"validation","validationCode":"function assertAbsoluteJsonPointer(p: string): void {\n  if (p !== '' && !p.startsWith('/')) {\n    throw new Error(`Invalid JSON pointer (must start with '/'): ${p}`);\n  }\n}\n// call before parseJsonPointer / schema get operations","typeGuard":"function isAbsoluteJsonPointer(p: string): p is `/${string}` {\n  return p === '' || p.startsWith('/');\n}","tryCatchPattern":"try {\n  const value = parseJsonPointer(pointer);\n} catch (e) {\n  if ((e as Error).message.startsWith('Relative pointer:')) {\n    pointer = '/' + pointer.replace(/^\\/+/, '');\n    // retry with normalized pointer\n  } else { throw e; }\n}","preventionTips":["Build pointers from segments with a helper that escapes ~ and / instead of string concatenation","Normalize user/schema $ref input to absolute pointers before passing to schema utilities","Unit-test pointer helpers with empty string, nested, and escaped-token cases"],"tags":["json-pointer","schema","validation"],"backgroundTag":"invalid-json-pointer","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}