{"record":{"id":"3ba242287ad07828","repo":"GoogleContainerTools/jib","slug":"manifesttemplateclass-cannot-be-instantiated","errorCode":null,"errorMessage":"manifestTemplateClass + \" cannot be instantiated\"","messagePattern":"manifestTemplateClass \\+ \" cannot be instantiated\"","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/image/json/ImageToJsonTranslator.java","lineNumber":214,"sourceCode":"      // Adds the container configuration reference.\n      DescriptorDigest containerConfigurationDigest =\n          containerConfigurationBlobDescriptor.getDigest();\n      long containerConfigurationSize = containerConfigurationBlobDescriptor.getSize();\n      template.setContainerConfiguration(containerConfigurationSize, containerConfigurationDigest);\n\n      // Adds the layers.\n      for (Layer layer : image.getLayers()) {\n        template.addLayer(\n            layer.getBlobDescriptor().getSize(), layer.getBlobDescriptor().getDigest());\n      }\n\n      return template;\n\n    } catch (InstantiationException\n        | IllegalAccessException\n        | NoSuchMethodException\n        | InvocationTargetException ex) {\n      throw new IllegalArgumentException(manifestTemplateClass + \" cannot be instantiated\", ex);\n    }\n  }\n}\n","sourceCodeStart":196,"sourceCodeEnd":218,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/image/json/ImageToJsonTranslator.java#L196-L218","documentation":"ImageToJsonTranslator.getManifestTemplate() instantiates the manifest template class via reflection. If the class has no accessible no-arg constructor or cannot be instantiated, the reflective exceptions are wrapped in an IllegalArgumentException naming the class.","triggerScenarios":"Passing a manifestTemplateClass to Image.builder(...) or ImageToJsonTranslator whose class lacks a public no-arg constructor, is abstract, or whose constructor throws; class initialization failure on load.","commonSituations":"Supplying a custom BuildableManifestTemplate implementation that doesn't follow the no-arg constructor convention; passing an abstract class or interface; classpath/version conflicts where the class's static init fails.","solutions":["Ensure the manifest template class is public, concrete, and has a public no-arg constructor","Use a built-in template such as V22ManifestTemplate or OCIManifestTemplate","Check the wrapped cause (ex.getCause()) for the underlying reflection error"],"exampleFix":"// before\nImage.builder(MyManifestTemplate.class); // abstract / no no-arg ctor\n// after\nImage.builder(V22ManifestTemplate.class); // public class with implicit no-arg constructor","handlingStrategy":"validation","validationCode":"Class<?> c = manifestTemplateClass;\nif (c.isInterface() || Modifier.isAbstract(c.getModifiers()) || c.getConstructors().length == 0)\n  throw new IllegalArgumentException(c + \" needs a public no-arg constructor\");","typeGuard":null,"tryCatchPattern":"try { Image.builder(clazz); } catch (IllegalArgumentException e) { inspect e.getCause() (InstantiationException/IllegalAccessException/etc.); }","preventionTips":["Manifest template classes must be public, concrete, with a no-arg constructor","Prefer built-in templates (V22ManifestTemplate, OCIManifestTemplate)","Always inspect the wrapped cause for the root reflection error"],"tags":["jib","reflection","manifest","instantiation"],"backgroundTag":"class-not-found","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}