floci-io/floci · error · AwsException

InvalidInputException

InvalidInputException

Error message

No buildspec found in source or request

What it means

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.

Source

Thrown at src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java:419

            }
        }

        if (buildspecOverride != null && !buildspecOverride.isBlank()) {
            return buildspecOverride;
        }
        if (project.getSource() != null && project.getSource().getBuildspec() != null
                && !project.getSource().getBuildspec().isBlank()) {
            return project.getSource().getBuildspec();
        }
        Path yml = workspace.resolve("buildspec.yml");
        if (Files.exists(yml)) {
            return Files.readString(yml);
        }
        Path yaml = workspace.resolve("buildspec.yaml");
        if (Files.exists(yaml)) {
            return Files.readString(yaml);
        }
        throw new AwsException("InvalidInputException", "No buildspec found in source or request", 400);
    }

    private List<String> buildEnvList(String region, Build build, Project project,
                                      ParsedBuildspec buildspec, String logStream) {
        Map<String, String> env = new LinkedHashMap<>();

        env.put("CODEBUILD_BUILD_ID", build.getId());
        env.put("CODEBUILD_BUILD_ARN", build.getArn());
        env.put("CODEBUILD_BUILD_NUMBER", String.valueOf(build.getBuildNumber()));
        env.put("CODEBUILD_BUILD_IMAGE", build.getEnvironment() != null && build.getEnvironment().getImage() != null
                ? build.getEnvironment().getImage() : project.getEnvironment().getImage());
        env.put("CODEBUILD_INITIATOR", "user");
        env.put("CODEBUILD_SRC_DIR", "/codebuild/output/src/src");
        env.put("CODEBUILD_LOG_PATH", logStream);
        env.put("AWS_DEFAULT_REGION", region);
        env.put("AWS_REGION", region);
        env.put("AWS_ACCESS_KEY_ID", "test");
        env.put("AWS_SECRET_ACCESS_KEY", "test");

View on GitHub (pinned to 62ff490619)

Solutions

  1. Set an inline buildspec on the project: source.buildspec (or pass --buildspec-override at StartBuild)
  2. Move buildspec.yml/buildspec.yaml to the repository root that gets checked out
  3. For NO_SOURCE projects, always supply the buildspec inline since there is no source to scan

Example fix

# before
source:
  type: NO_SOURCE
  # no buildspec anywhere

# after
source:
  type: NO_SOURCE
  buildspec: |
    version: 0.2
    phases:
      build:
        commands:
          - echo hi
Defensive patterns

Strategy: validation

Validate before calling

// Java, SDK v2 - ensure a buildspec exists before StartBuild
String inline = project.source() != null && project.source().buildspec() != null
        ? project.source().buildspec() : null;
boolean filePresent = Files.exists(repoRoot.resolve("buildspec.yml"))
        || Files.exists(repoRoot.resolve("buildspec.yaml"));
if ((inline == null || inline.isBlank()) && !filePresent && buildspecOverride == null) {
    throw new IllegalArgumentException("No buildspec: set source.buildspec or add buildspec.yml at repo root");
}

Try / catch

catch (InvalidInputException e) {
    if (e.getMessage().contains("No buildspec")) {
        // configuration gap: fix project or repo, then retry once
        fixAndRetryStartBuild(projectName);
    } else throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14). Data as JSON: /api/errors/5e5524e09e89f62a. Report an issue: GitHub.