{"record":{"id":"5e5524e09e89f62a","repo":"floci-io/floci","slug":"invalidinputexception-5e5524","errorCode":"InvalidInputException","errorMessage":"No buildspec found in source or request","messagePattern":"No buildspec found in source or request","errorType":"exception","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java","lineNumber":419,"sourceCode":"            }\n        }\n\n        if (buildspecOverride != null && !buildspecOverride.isBlank()) {\n            return buildspecOverride;\n        }\n        if (project.getSource() != null && project.getSource().getBuildspec() != null\n                && !project.getSource().getBuildspec().isBlank()) {\n            return project.getSource().getBuildspec();\n        }\n        Path yml = workspace.resolve(\"buildspec.yml\");\n        if (Files.exists(yml)) {\n            return Files.readString(yml);\n        }\n        Path yaml = workspace.resolve(\"buildspec.yaml\");\n        if (Files.exists(yaml)) {\n            return Files.readString(yaml);\n        }\n        throw new AwsException(\"InvalidInputException\", \"No buildspec found in source or request\", 400);\n    }\n\n    private List<String> buildEnvList(String region, Build build, Project project,\n                                      ParsedBuildspec buildspec, String logStream) {\n        Map<String, String> env = new LinkedHashMap<>();\n\n        env.put(\"CODEBUILD_BUILD_ID\", build.getId());\n        env.put(\"CODEBUILD_BUILD_ARN\", build.getArn());\n        env.put(\"CODEBUILD_BUILD_NUMBER\", String.valueOf(build.getBuildNumber()));\n        env.put(\"CODEBUILD_BUILD_IMAGE\", build.getEnvironment() != null && build.getEnvironment().getImage() != null\n                ? build.getEnvironment().getImage() : project.getEnvironment().getImage());\n        env.put(\"CODEBUILD_INITIATOR\", \"user\");\n        env.put(\"CODEBUILD_SRC_DIR\", \"/codebuild/output/src/src\");\n        env.put(\"CODEBUILD_LOG_PATH\", logStream);\n        env.put(\"AWS_DEFAULT_REGION\", region);\n        env.put(\"AWS_REGION\", region);\n        env.put(\"AWS_ACCESS_KEY_ID\", \"test\");\n        env.put(\"AWS_SECRET_ACCESS_KEY\", \"test\");","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java#L401-L437","documentation":"Thrown by CodeBuildRunner when resolving the buildspec for a build: the project's source.buildspec is null/blank AND neither buildspec.yml nor buildspec.yaml exists at the root of the downloaded source workspace. AWS CodeBuild behaves the same way, rejecting builds with no discoverable buildspec. Returned as InvalidInputException 400.","triggerScenarios":"StartBuild on a project with source type NO_SOURCE but no buildspec in project.source.buildspec and no buildspecOverride; a Git repo whose buildspec.yml sits in a subdirectory (Floci only checks the workspace root); a repo with a differently named file (e.g. .buildspec.yml or build.yml).","commonSituations":"Monorepos where the buildspec lives next to the service, not at repo root (real AWS allows buildspec path config; here only root is checked unless source.buildspec is set);NO_SOURCE projects created without an inline buildspec; renaming the file during a refactor.","solutions":["Set an inline buildspec on the project: source.buildspec (or pass --buildspec-override at StartBuild)","Move buildspec.yml/buildspec.yaml to the repository root that gets checked out","For NO_SOURCE projects, always supply the buildspec inline since there is no source to scan"],"exampleFix":"# before\nsource:\n  type: NO_SOURCE\n  # no buildspec anywhere\n\n# after\nsource:\n  type: NO_SOURCE\n  buildspec: |\n    version: 0.2\n    phases:\n      build:\n        commands:\n          - echo hi","handlingStrategy":"validation","validationCode":"// Java, SDK v2 - ensure a buildspec exists before StartBuild\nString inline = project.source() != null && project.source().buildspec() != null\n        ? project.source().buildspec() : null;\nboolean filePresent = Files.exists(repoRoot.resolve(\"buildspec.yml\"))\n        || Files.exists(repoRoot.resolve(\"buildspec.yaml\"));\nif ((inline == null || inline.isBlank()) && !filePresent && buildspecOverride == null) {\n    throw new IllegalArgumentException(\"No buildspec: set source.buildspec or add buildspec.yml at repo root\");\n}","typeGuard":null,"tryCatchPattern":"catch (InvalidInputException e) {\n    if (e.getMessage().contains(\"No buildspec\")) {\n        // configuration gap: fix project or repo, then retry once\n        fixAndRetryStartBuild(projectName);\n    } else throw e;\n}","preventionTips":["Keep buildspec.yml at the repository root (only root is scanned)","For monorepos or NO_SOURCE, inline the buildspec in project.source.buildspec","Include a buildspec assertion in pre-build checks"],"tags":["codebuild","buildspec","start-build","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}