{"record":{"id":"1467141b17490bd9","repo":"angular/angular-cli","slug":"invalid-format-version-detected-expected-1-f","errorCode":null,"errorMessage":"Invalid format version detected - Expected:[ 1 ] Found: [ ${version} ]","messagePattern":"Invalid format version detected - Expected:\\[ 1 \\] Found: \\[ (.+?) \\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/core/src/workspace/json/reader.ts","lineNumber":63,"sourceCode":"): Promise<WorkspaceDefinition> {\n  const raw = await host.readFile(path);\n  if (raw === undefined) {\n    throw new Error('Unable to read workspace file.');\n  }\n\n  const ast = parseTree(raw, undefined, { allowTrailingComma: true, disallowComments: false });\n  if (ast?.type !== 'object' || !ast.children) {\n    throw new Error('Invalid workspace file - expected JSON object.');\n  }\n\n  // Version check\n  const versionNode = findNodeAtLocation(ast, ['version']);\n  if (!versionNode) {\n    throw new Error('Unknown format - version specifier not found.');\n  }\n  const version = versionNode.value;\n  if (version !== 1) {\n    throw new Error(`Invalid format version detected - Expected:[ 1 ] Found: [ ${version} ]`);\n  }\n\n  const context: ParserContext = {\n    host,\n    metadata: new JsonWorkspaceMetadata(path, ast, raw),\n    trackChanges: true,\n    unprefixedWorkspaceExtensions: new Set([\n      ...ANGULAR_WORKSPACE_EXTENSIONS,\n      ...(options.allowedWorkspaceExtensions ?? []),\n    ]),\n    unprefixedProjectExtensions: new Set([\n      ...ANGULAR_PROJECT_EXTENSIONS,\n      ...(options.allowedProjectExtensions ?? []),\n    ]),\n    error(message, _node) {\n      // TODO: Diagnostic reporting support\n      throw new Error(message);\n    },","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/core/src/workspace/json/reader.ts#L45-L81","documentation":"The only supported workspace format version is 1. After locating the 'version' node, the reader compares its value to 1 and throws this templated Error showing the expected and found values for any other number/type. This catches files written for newer or unknown format revisions.","triggerScenarios":"angular.json containing \"version\": 2 (or a string \"1\", null, etc.) passed to readJsonWorkspace; note that string \"1\" !== numeric 1 and also fails.","commonSituations":"File edited by a newer tool or hand-updated to a hypothetical v2; version value accidentally quoted (\"version\": \"1\") making it a string; config generators emitting a wrong version constant.","solutions":["Set \"version\": 1 (numeric, unquoted) at the top level of the workspace file.","If the file came from a newer tool version, use a matching/newer version of the tooling that supports that format.","Restore the file from version control if the version was modified by mistake."],"exampleFix":"// before\n{ \"version\": \"1\", \"projects\": {} }\n// after\n{ \"version\": 1, \"projects\": {} }","handlingStrategy":"validation","validationCode":"const parsed = JSON.parse(await readFile('angular.json', 'utf8'));\nif (parsed.version !== 1) {\n  throw new Error(`Unsupported workspace version: ${JSON.stringify(parsed.version)}; expected numeric 1`);\n}","typeGuard":"function isSupportedWorkspaceVersion(ws: unknown): ws is { version: 1 } {\n  return typeof ws === 'object' && ws !== null\n    && (ws as { version?: unknown }).version === 1;\n}","tryCatchPattern":"try {\n  const ws = await readWorkspace('angular.json', host);\n} catch (e) {\n  if (e.message.startsWith('Invalid format version detected')) {\n    console.error('Set \"version\": 1 (numeric, unquoted) in angular.json, or upgrade the tooling that produced the file.');\n  } else throw e;\n}","preventionTips":["Ensure the version value is the number 1, not the string \"1\" — strict !== comparison fails on strings","Do not bump the version field manually hoping to unlock features","Match tool versions: files from newer generators need a tooling version that supports their format","Validate angular.json against the official schema in CI"],"tags":["workspace","version-mismatch","schema-validation","angular-devkit"],"backgroundTag":"unsupported-version","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}