{"record":{"id":"712683b08fd40ef0","repo":"GoogleContainerTools/jib","slug":"only-filelayers-are-supported-at-this-time","errorCode":null,"errorMessage":"Only FileLayers are supported at this time.","messagePattern":"Only FileLayers are supported at this time\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"jib-cli/src/main/java/com/google/cloud/tools/jib/cli/buildfile/Layers.java","lineNumber":179,"sourceCode":"                    addedDirectories.add(parent);\n                    if (parent.equals(src)) {\n                      break;\n                    }\n                    parent = Verify.verifyNotNull(parent.getParent());\n                  }\n                  layerBuiler.addEntry(\n                      newEntry.apply(path, filePropertiesStack.getFilePermissions()));\n                }\n              }\n            }\n          }\n          copySpec.getProperties().ifPresent(ignored -> filePropertiesStack.pop());\n        }\n        fileLayer.getProperties().ifPresent(ignored -> filePropertiesStack.pop());\n        // TODO: add logging/handling for empty layers\n        layers.add(layerBuiler.build());\n      } else {\n        throw new UnsupportedOperationException(\"Only FileLayers are supported at this time.\");\n      }\n    }\n    layersSpec.getProperties().ifPresent(ignored -> filePropertiesStack.pop());\n    return layers;\n  }\n\n  @VisibleForTesting\n  static PathMatcher toPathMatcher(String glob) {\n    return FileSystems.getDefault()\n        .getPathMatcher(\n            \"glob:\" + ((glob.endsWith(\"/\") || glob.endsWith(\"\\\\\")) ? glob + \"**\" : glob));\n  }\n}\n","sourceCodeStart":161,"sourceCodeEnd":193,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-cli/src/main/java/com/google/cloud/tools/jib/cli/buildfile/Layers.java#L161-L193","documentation":"Jib CLI's buildfile parser only supports layers of type FileLayer. When a `layers:` list in the buildfile YAML contains an entry of another layer type (no corresponding FileLayer builder applies), toLayers throws this UnsupportedOperationException. The TODO comment shows empty/other layer kinds are simply not implemented yet.","triggerScenarios":"Calling toLayers on a LayersSpec whose entries contain a layer that is not a FileLayer — e.g. a layer entry in the buildfile YAML with a different/unrecognized type name, so the instanceof/branch for FileLayer falls through to the else clause.","commonSituations":"Hand-writing a jib.build.yaml buildfile with a layer type copied from docs of a newer version or another tool; typos in the layer type key; using buildfile features not yet supported by the installed Jib CLI version.","solutions":["Change the layer entry in the buildfile so it is a standard FileLayer (type with files/properties entries)","Check the Jib CLI version's supported buildfile schema and remove unsupported layer types","Upgrade Jib CLI to a version that may support more layer kinds"],"exampleFix":"// before (buildfile)\nlayers:\n  - name: 'other-layer'\n    type: 'CustomLayer'\n// after\nlayers:\n  - name: 'files'\n    files:\n      - source: ./app\n        destination: /app","handlingStrategy":"validation","validationCode":"for (var layer : layersSpec.getLayers()) { if (!(layer instanceof FileLayer)) throw new IllegalArgumentException(\"Unsupported layer type: \" + layer.getClass().getSimpleName()); }","typeGuard":"boolean isFileLayer(Object l) { return l instanceof FileLayer; }","tryCatchPattern":"try { layers = toLayers(layersSpec); } catch (UnsupportedOperationException e) { log.error(\"Unsupported layer type in buildfile: {}\", e.getMessage()); }","preventionTips":["Only use FileLayer entries in jib buildfiles","Validate buildfile YAML against the schema for your Jib CLI version","Pin Jib CLI version consistent with buildfile features used"],"tags":["jib","cli","buildfile","unsupported-layer-type"],"backgroundTag":"unsupported-operation","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}