{"record":{"id":"da6c2185eb11bcc5","repo":"angular/angular-cli","slug":"unknown-error","errorCode":"UNKNOWN_ERROR","errorMessage":"UNKNOWN_ERROR","messagePattern":"UNKNOWN_ERROR","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/package-managers/parsers.ts","lineNumber":628,"sourceCode":"    // Status codes in the 200-299 range are successful.\n    if (statusCode < 200 || statusCode >= 300) {\n      logger?.debug(`  Detected HTTP error status code '${statusCode}' in verbose output.`);\n\n      return {\n        code: `E${statusCode}`,\n        summary: `Request failed with status code ${statusCode}.`,\n      };\n    }\n  }\n\n  // Fallback to the JSON error type if no HTTP status code is present.\n  for (const json of parseJsonLines(output, logger)) {\n    if (json.type === 'error' && typeof json.data === 'string') {\n      const summary = json.data;\n      logger?.debug(`  Successfully parsed generic yarn classic error.`);\n\n      return {\n        code: 'UNKNOWN_ERROR',\n        summary,\n      };\n    }\n  }\n\n  logger?.debug('  Failed to parse yarn classic error. No structured error found.');\n\n  return null;\n}\n\n/**\n * Parses the output of `bun pm ls`.\n *\n * Bun does not support JSON output for `pm ls`. The output is a tree structure:\n * ```\n * /path/to/project node_modules (1084)\n * ├── @angular/core@20.3.15\n * ├── rxjs @7.8.2","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/package-managers/parsers.ts#L610-L646","documentation":"parseYarnClassicError is the fallback parser for Yarn 1 (classic) failures. It scans the JSON-lines output for a structured {type:'error', data:string} record and, when found, returns code 'UNKNOWN_ERROR' with that message as the summary — Yarn classic provides no error code taxonomy, so the CLI labels it generically.","triggerScenarios":"A `yarn add`/install command run through the Angular CLI package manager fails and its output contains a typed error JSON line; the parser converts it to UNKNOWN_ERROR with the raw Yarn summary. Any Yarn 1 network, resolver, or integrity failure surfaces this way.","commonSituations":"Registry outages or 404s for a package version, peer dependency resolution conflicts, network/proxy failures, corrupted yarn.lock, or Yarn cache issues.","solutions":["Read the 'summary' field in the error details — it contains Yarn's actual reason — and fix that underlying issue.","Retry after confirming registry reachability (npm ping / curl the registry URL); many cases are transient network failures.","Delete yarn.lock and node_modules and reinstall if resolution state is corrupted (`rm -rf node_modules yarn.lock && yarn install`).","Clear the Yarn cache (`yarn cache clean`) for corrupted-package errors, or pin a resolvable version of the failing dependency."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-check registry reachability before install\nconst res = await fetch('https://registry.yarnpkg.com/<pkg>');\nif (!res.ok) throw new Error(`Registry unreachable (HTTP ${res.status}); aborting install`);","typeGuard":"function isPackageMgrError(e: unknown): e is { code: string; summary: string } {\n  return typeof e === 'object' && e !== null && 'code' in e && 'summary' in e &&\n    typeof (e as { summary: unknown }).summary === 'string';\n}","tryCatchPattern":"try {\n  await addPackage(name);\n} catch (e) {\n  if (isPackageMgrError(e) && e.code === 'UNKNOWN_ERROR') {\n    console.error(`Yarn classic failed: ${e.summary} — fix the underlying cause or retry on transient network errors.`);\n  } else throw e;\n}","preventionTips":["Treat UNKNOWN_ERROR as opaque: always read the summary field for the real Yarn reason.","Keep yarn.lock committed and in sync to avoid resolver conflicts.","Verify registry connectivity/proxy settings before installs in CI.","Clear node_modules and the Yarn cache when installs fail repeatedly with corrupt-package messages."],"tags":["yarn","package-manager","network"],"backgroundTag":"package-install-failed","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}