{"record":{"id":"1325bc71005b41d7","repo":"angular/angular-cli","slug":"unknown-error-occurred-inlining-file-options-fi","errorCode":null,"errorMessage":"Unknown error occurred inlining file \"${options.filename}\"","messagePattern":"Unknown error occurred inlining file \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/utils/process-bundle.ts","lineNumber":146,"sourceCode":"      configFile: false,\n      sourceType: 'unambiguous',\n      filename: options.filename,\n    });\n  } catch (error) {\n    assertIsError(error);\n\n    // Make the error more readable.\n    // Same errors will contain the full content of the file as the error message\n    // Which makes it hard to find the actual error message.\n    const index = error.message.indexOf(')\\n');\n    const msg = index !== -1 ? error.message.slice(0, index + 1) : error.message;\n    throw new Error(`${msg}\\nAn error occurred inlining file \"${options.filename}\"`, {\n      cause: error,\n    });\n  }\n\n  if (!ast) {\n    throw new Error(`Unknown error occurred inlining file \"${options.filename}\"`);\n  }\n\n  if (!USE_LOCALIZE_PLUGINS) {\n    return inlineLocalesDirect(ast, options);\n  }\n\n  const diagnostics = [];\n  for (const locale of i18n.inlineLocales) {\n    const isSourceLocale = locale === i18n.sourceLocale;\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    const translations: any = isSourceLocale ? {} : i18n.locales[locale].translation || {};\n    let localeDataContent;\n    if (options.setLocale) {\n      // If locale data is provided, load it and prepend to file\n      const localeDataPath = i18n.locales[locale]?.dataPath;\n      if (localeDataPath) {\n        localeDataContent = await loadLocaleData(localeDataPath, true);\n      }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/utils/process-bundle.ts#L128-L164","documentation":"After attempting to parse/inling a bundle, if the resulting AST is still undefined without a caught error, inlineLocales throws this as a last-resort signal that inlining produced no parse result for the given file. It indicates an unexpected/unknown failure rather than a reported translation error.","triggerScenarios":"inlineLocales processes a file and no exception was thrown but the AST variable is falsy — i.e. the translation parser returned nothing for options.filename.","commonSituations":"Edge cases with empty or invalid bundles, unsupported bundle formats passed to the inliner, or plugin/tool version mismatches where the parser silently returns no result.","solutions":["Verify the input bundle exists, is non-empty, and is valid JavaScript the inliner can parse.","Update @angular-devkit/build-angular and @angular/localize to matching versions.","Log inputs and reproduce with a minimal bundle; file an issue with the file content if it persists."],"exampleFix":"// before: inlining a corrupt/empty bundle\nawait inlineLocales({ filename: 'main.js', code: '', ... });\n// after: guard before calling\nif (!options.code || !options.code.trim()) throw new Error('bundle is empty');\nawait inlineLocales(options);","handlingStrategy":"validation","validationCode":"const code = fs.readFileSync(bundlePath, 'utf8');\nif (!code.trim()) throw new Error(`Bundle ${bundlePath} is empty; rebuild before inlining.`);","typeGuard":"function isAstDefined(ast: unknown): ast is NonNullable<typeof ast> {\n  return ast !== null && ast !== undefined;\n}","tryCatchPattern":"try {\n  await inlineLocales(options);\n} catch (e) {\n  if (String(e.message).includes('Unknown error occurred inlining')) {\n    // fall back to re-parsing the bundle manually or failing fast with diagnostics\n  } else throw e;\n}","preventionTips":["Ensure bundles are non-empty and valid JS before inlining.","Keep build tooling and @angular/localize at compatible versions.","Reproduce unknown inlining failures with a minimal bundle and report upstream.","Avoid passing hand-modified or minified-in-unusual-ways bundles to the inliner."],"tags":["i18n","angular-cli","unknown-error","build"],"backgroundTag":"unexpected-null-result","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}