{"record":{"id":"1722fa428ada868e","repo":"angular/angular","slug":"sanitization-unexpected-ctx","errorCode":"SANITIZATION_UNEXPECTED_CTX","errorMessage":"Unexpected SecurityContext ${ctx} (see ${XSS_SECURITY_URL})","messagePattern":"Unexpected SecurityContext (.+?) \\(see (.+?)\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"packages/platform-browser/src/security/dom_sanitization_service.ts","lineNumber":208,"sourceCode":"          (typeof ngDevMode === 'undefined' || ngDevMode) &&\n            'unsafe value used in a script context',\n        );\n      case SecurityContext.URL:\n        if (allowSanitizationBypassOrThrow(value, BypassType.Url)) {\n          return unwrapSafeValue(value);\n        }\n        return _sanitizeUrl(String(value));\n      case SecurityContext.RESOURCE_URL:\n        if (allowSanitizationBypassOrThrow(value, BypassType.ResourceUrl)) {\n          return unwrapSafeValue(value);\n        }\n        throw new RuntimeError(\n          RuntimeErrorCode.SANITIZATION_UNSAFE_RESOURCE_URL,\n          (typeof ngDevMode === 'undefined' || ngDevMode) &&\n            `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`,\n        );\n      default:\n        throw new RuntimeError(\n          RuntimeErrorCode.SANITIZATION_UNEXPECTED_CTX,\n          (typeof ngDevMode === 'undefined' || ngDevMode) &&\n            `Unexpected SecurityContext ${ctx} (see ${XSS_SECURITY_URL})`,\n        );\n    }\n  }\n\n  override bypassSecurityTrustHtml(value: string): SafeHtml {\n    return bypassSanitizationTrustHtml(value);\n  }\n  override bypassSecurityTrustStyle(value: string): SafeStyle {\n    return bypassSanitizationTrustStyle(value);\n  }\n  override bypassSecurityTrustScript(value: string): SafeScript {\n    return bypassSanitizationTrustScript(value);\n  }\n  override bypassSecurityTrustUrl(value: string): SafeUrl {\n    return bypassSanitizationTrustUrl(value);","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/angular/angular/blob/51cb07e98081ab7e4e84a9e0949266a8e19cca84/packages/platform-browser/src/security/dom_sanitization_service.ts#L190-L226","documentation":"Error \"Unexpected SecurityContext ${ctx} (see ${XSS_SECURITY_URL})\" thrown in angular/angular.","triggerScenarios":"Thrown at packages/platform-browser/src/security/dom_sanitization_service.ts:208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["A sanitizer was called with an unsupported SecurityContext; this is framework-internal — update Angular or avoid calling the sanitizer with custom contexts."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"51cb07e98081ab7e4e84a9e0949266a8e19cca84","analyzedAt":"2026-08-22T07:04:54.531Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}