{"record":{"id":"4f775e948ab59fb6","repo":"angular/angular-cli","slug":"unknown-protocol-on-url-url","errorCode":null,"errorMessage":"Unknown Protocol on url \"${url}\".","messagePattern":"Unknown Protocol on url \"(.+?)\"\\.","errorType":"exception","errorClass":"UnknownUrlSourceProtocol","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/schematics/src/engine/engine.ts","lineNumber":377,"sourceCode":"  transformOptions<OptionT extends object, ResultT extends object>(\n    schematic: Schematic<CollectionT, SchematicT>,\n    options: OptionT,\n    context?: TypedSchematicContext<CollectionT, SchematicT>,\n  ): Observable<ResultT> {\n    return this._host.transformOptions<OptionT, ResultT>(schematic.description, options, context);\n  }\n\n  createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionT, SchematicT>): Source {\n    switch (url.protocol) {\n      case 'null:':\n        return () => new NullTree();\n      case 'empty:':\n        return () => empty();\n    }\n\n    const hostSource = this._host.createSourceFromUrl(url, context);\n    if (!hostSource) {\n      throw new UnknownUrlSourceProtocol(url.toString());\n    }\n\n    return hostSource;\n  }\n\n  executePostTasks(): Observable<void> {\n    const executors = new Map<string, TaskExecutor>();\n\n    const taskObservable = observableFrom(this._taskSchedulers).pipe(\n      concatMap((scheduler) => scheduler.finalize()),\n      concatMap((task) => {\n        const { name, options } = task.configuration;\n\n        const executor = executors.get(name);\n        if (executor) {\n          return executor(options, task.context);\n        }\n","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/schematics/src/engine/engine.ts#L359-L395","documentation":"Thrown by Engine#createSourceFromUrl when a Source URL scheme is not one of the protocols the schematics engine knows how to handle (e.g. 'file:', 'empty:', or a registered handler). If the host's createSourceFromUrl returns falsy, the URL protocol is unsupported. This is a fail-fast guard so the user knows their Source URL scheme cannot be resolved.","triggerScenarios":"Calling sourceUrl(url) (or a rule/source with a url) whose protocol is not 'file:' or 'empty:' and which is not registered via HostCreateOptions handler — the host lookup returns undefined.","commonSituations":"Typos in URL scheme (e.g. 'https://', 'http://', relative paths with no protocol); using a custom scheme without registering a protocol handler on the HostTree; copying examples from docs using schemes the version in use doesn't support.","solutions":["Use a supported protocol, e.g. url('file:./templates') or the 'empty:' scheme.","Register a custom protocol handler on the host so createSourceFromUrl can resolve the scheme.","Log/print the URL and verify the scheme spelling and that a filesystem path is valid."],"exampleFix":"// before\nconst src = url('https://example.com/templates');\n// after\nconst src = url('file:./templates');","handlingStrategy":"validation","validationCode":"const supported = ['file:', 'empty:'];\nif (!supported.some(p => url.startsWith(p))) {\n  throw new Error(`Unsupported URL protocol: ${url}`);\n}","typeGuard":"function hasSupportedProtocol(url: URL): boolean {\n  return url.protocol === 'file:' || url.protocol === 'empty:';\n}","tryCatchPattern":"try {\n  const src = host.createSourceFromUrl(url, context);\n  if (!src) throw new Error(`No handler for protocol: ${url.protocol}`);\n} catch (err) {\n  console.error(`URL protocol not supported: ${url}`);\n}","preventionTips":["Only use documented protocols ('file:', 'empty:') or register custom handlers.","Centralize URL construction in a helper that validates the scheme.","Add a unit test that calls every source URL used in your collection."],"tags":["schematics","url","protocol","configuration"],"backgroundTag":"unsupported-url-protocol","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}