{"record":{"id":"637d50a8867caa16","repo":"OpenAPITools/openapi-generator","slug":"a-target-generation-was-attempted-but-no-files-we","errorCode":null,"errorMessage":"A target generation was attempted, but no files were created!","messagePattern":"A target generation was attempted, but no files were created!","errorType":"http","errorClass":"ResponseStatusException","httpStatus":400,"severity":"error","filePath":"modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java","lineNumber":159,"sourceCode":"                }\n                codegenConfig.openapiNormalizer().put(ruleOperands[0], ruleOperands[1]);\n            }\n        }\n\n        codegenConfig.setOutputDir(outputFolder);\n\n        clientOptInput.config(codegenConfig);\n\n        try {\n            List<File> files = new DefaultGenerator().opts(clientOptInput).generate();\n            if (files.size() > 0) {\n                List<File> filesToAdd = new ArrayList<>();\n                LOGGER.debug(\"adding to {}\", outputFolder);\n                filesToAdd.add(new File(outputFolder));\n                ZipUtil zip = new ZipUtil();\n                zip.compressFiles(filesToAdd, outputFilename);\n            } else {\n                throw new ResponseStatusException(HttpStatus.BAD_REQUEST,\n                        \"A target generation was attempted, but no files were created!\");\n            }\n            for (File file : files) {\n                try {\n                    file.delete();\n                } catch (Exception e) {\n                    LOGGER.error(\"unable to delete file \" + file.getAbsolutePath(), e);\n                }\n            }\n            try {\n                new File(outputFolder).delete();\n            } catch (Exception e) {\n                LOGGER.error(\"unable to delete output folder \" + outputFolder, e);\n            }\n        } catch (Exception e) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Unable to build target: \" + e.getMessage(), e);\n        }\n        return outputFilename;","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java#L141-L177","documentation":"Thrown when DefaultGenerator().opts(...).generate() completed without exception but returned an empty file list (Generator.java:150-161), so there is nothing to zip into the -bundle.zip. The spec parsed and the generator ran; the run simply produced zero output files. Typical specs that trigger this have no paths and no components (a structurally valid but empty document), so every generator skips all write steps.","triggerScenarios":"Posting {\"openapi\":\"3.0.0\",\"info\":{...}} with no \"paths\" (or paths:{}); specs whose only content lives in extensions the generator ignores; exotic combinations where the selected generator emits only files it later filters out.","commonSituations":"Starting a spec skeleton and testing the generator before writing any operations; tooling that strips empty paths objects; specs assembled from templates where the paths section failed to merge.","solutions":["Add at least one path with one operation (get/post/...) to the spec and regenerate","Verify locally that the document has a non-empty paths (or meaningful components for the target generator)","If the spec intentionally has no operations, the online generator cannot produce a bundle — use the CLI with a generator that supports it or skip generation"],"exampleFix":"# before\n{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"t\",\"version\":\"1\"}}          # no paths -> 400 no files were created\n\n# after\n{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"t\",\"version\":\"1\"},\"paths\":{\"/ping\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}","handlingStrategy":"try-catch","validationCode":"// a spec with no paths and no components generates nothing\nOpenAPI o = new OpenAPIParser().readContents(specJson, null, new ParseOptions()).getOpenAPI();\nboolean generatable = o != null\n    && ((o.getPaths() != null && !o.getPaths().isEmpty())\n        || (o.getComponents() != null && o.getComponents().getSchemas() != null && !o.getComponents().getSchemas().isEmpty()));\nif (!generatable) throw new IllegalArgumentException(\"spec has no paths/components; generation would be empty\");","typeGuard":"boolean hasGeneratableContent(OpenAPI o) {\n    return o.getPaths() != null && !o.getPaths().isEmpty();\n}","tryCatchPattern":"catch (HttpClientErrorException.BadRequest e) {\n    if (e.getResponseBodyAsString().contains(\"no files were created\")) {\n        // spec parsed but produced nothing: add operations, then regenerate\n        throw new IllegalStateException(\"spec skeleton has no operations — nothing to generate\", e);\n    }\n}","preventionTips":["Write at least one path/operation before testing generation","Check merged/generated specs for empty paths sections in build tooling"],"tags":["http-400","empty-spec","code-generation","openapi-generator-online"],"backgroundTag":"empty-generation-output","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}