{"record":{"id":"992a79ad59b45832","repo":"angular/angular-cli","slug":"tree-type-is-not-supported-992a79","errorCode":null,"errorMessage":"Tree type is not supported.","messagePattern":"Tree type is not supported\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/schematics/src/tree/static.ts","lineNumber":38,"sourceCode":"\nexport function merge(\n  tree: Tree,\n  other: Tree,\n  strategy: MergeStrategy = MergeStrategy.Default,\n): Tree {\n  tree.merge(other, strategy);\n\n  return tree;\n}\n\nexport function partition(tree: Tree, predicate: FilePredicate<boolean>): [Tree, Tree] {\n  if (tree instanceof HostTree) {\n    return [\n      new FilterHostTree(tree, predicate),\n      new FilterHostTree(tree, (path, entry) => !predicate(path, entry)),\n    ];\n  } else {\n    throw new SchematicsException('Tree type is not supported.');\n  }\n}\n","sourceCodeStart":20,"sourceCodeEnd":41,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/schematics/src/tree/static.ts#L20-L41","documentation":"partition() only knows how to split a HostTree into two FilterHostTree halves (kept/filtered). If the tree instance is any other Tree implementation, it throws SchematicsException('Tree type is not supported.') because filtered views can't be built generically.","triggerScenarios":"Calling partition(tree, predicate) with a custom Tree implementation (not instanceof HostTree), e.g. a DelegateTree wrapper, a test stub implementing Tree, or a tree from a custom engine host.","commonSituations":"Custom schematic tooling or testing utilities that pass mock trees into partition; wrapping trees in custom Tree classes for instrumentation; third-party tree implementations incompatible with HostTree.","solutions":["Ensure the tree passed to partition is a HostTree (or FilterHostTree, which extends it)","For DelegateTree, extract and partition the underlying host tree (tree.branch() results or the wrapped host)","Implement the partition yourself for custom trees: build two FilterHostTrees from the base HostTree","In tests, use unit tree utilities from @angular-devkit/schematics (e.g. new HostTree(new virtualFs.SimpleMemoryHost())) instead of hand-rolled stubs"],"exampleFix":"// before\nreturn partition(myCustomTree as Tree, predicate);\n// after\nimport { HostTree } from '@angular-devkit/schematics';\nif (!(myCustomTree instanceof HostTree)) {\n  throw new Error('partition requires a HostTree');\n}\nreturn partition(myCustomTree, predicate);","handlingStrategy":"type-guard","validationCode":"if (!(tree instanceof HostTree)) {\n  throw new Error('partition() requires a HostTree');\n}\nconst [kept, rest] = partition(tree, predicate);","typeGuard":"import { HostTree } from '@angular-devkit/schematics';\nfunction isHostTree(t: unknown): t is HostTree {\n  return t instanceof HostTree;\n}","tryCatchPattern":"try {\n  const parts = partition(tree, predicate);\n} catch (e) {\n  if (String(e).includes('Tree type is not supported')) {\n    // fall back to manual filtering on tree.getDir('/').visit(...)\n  } else throw e;\n}","preventionTips":["Only construct trees via HostTree/virtual-fs utilities in tooling","Unwrap DelegateTree before calling partition","Avoid hand-rolled Tree implementations in tests; use the library's testing utils","Type parameters as HostTree when the API requires it so mistakes surface at compile time"],"tags":["schematics","tree","type-error","angular"],"backgroundTag":"unsupported-tree-type","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}