floci-io/floci · error · AwsException
InvalidInputException
InvalidInputException
Error message
Buildspec content is empty
What it means
Thrown by BuildspecParser.parse when the buildspec string passed to it is null or contains only whitespace. Floci calls this parser during StartBuild after resolving the buildspec from the project's source.buildspec field, an explicit buildspecOverride, or a buildspec.yml/buildspec.yaml file in the downloaded source. It surfaces as an InvalidInputException HTTP 400, mirroring AWS CodeBuild's rejection of empty buildspec content.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/codebuild/BuildspecParser.java:42
List<String> installCommands,
List<String> preBuildCommands,
List<String> buildCommands,
List<String> postBuildCommands,
ParsedArtifacts artifacts
) {}
record ParsedArtifacts(
String type,
List<String> files,
String baseDirectory,
boolean discardPaths,
String name,
String packaging
) {}
static ParsedBuildspec parse(String content) {
if (content == null || content.isBlank()) {
throw new AwsException("InvalidInputException", "Buildspec content is empty", 400);
}
try {
JsonNode root = YAML.readTree(content);
JsonNode envNode = root.path("env");
Map<String, String> envVars = parseStringMap(envNode.path("variables"));
Map<String, String> paramStore = parseStringMap(envNode.path("parameter-store"));
Map<String, String> secretsMgr = parseStringMap(envNode.path("secrets-manager"));
JsonNode phases = root.path("phases");
List<String> install = parseCommands(phases.path("install"));
List<String> preBuild = parseCommands(phases.path("pre_build"));
List<String> build = parseCommands(phases.path("build"));
List<String> postBuild = parseCommands(phases.path("post_build"));
ParsedArtifacts artifacts = parseArtifacts(root.path("artifacts"));
return new ParsedBuildspec(envVars, paramStore, secretsMgr,View on GitHub (pinned to 62ff490619)
Solutions
- Provide non-blank buildspec content: either set source.buildspec on the project, pass buildspecOverride in StartBuild, or commit a non-empty buildspec.yml at the source root
- If generating the buildspec in CI, assert the file is non-empty before triggering StartBuild
- Verify you are reading the file you think you are (buildspec.yml vs buildspec.yaml in a subdirectory is ignored; only workspace root is checked)
Example fix
# before
aws codebuild start-build --project-name demo --buildspec-override ''
# after
cat > buildspec.yml <<'EOF'
version: 0.2
phases:
build:
commands:
- echo building
EOF
aws codebuild start-build --project-name demo Defensive patterns
Strategy: validation
Validate before calling
// Java, AWS SDK v2 - before StartBuild
String buildspec = resolveBuildspec(project, override); // project.source().buildspec(), override, or file read
if (buildspec == null || buildspec.isBlank()) {
throw new IllegalArgumentException("Buildspec is empty - set source.buildspec, buildspecOverride, or commit buildspec.yml");
} Try / catch
// Catch as InvalidInputException from the SDK; empty buildspec is a caller bug - fail fast, do not retry
catch (InvalidInputException e) {
if (e.getMessage().contains("empty")) throw new IllegalStateException("Buildspec missing: " + e.getMessage(), e);
throw e;
} Prevention
- Never pass buildspecOverride as empty string; omit the field instead
- Assert generated buildspec.yml is non-empty in CI before triggering builds
- For NO_SOURCE projects always set source.buildspec inline
When it happens
Trigger: Calling StartBuild with a buildspecOverride that is an empty string; creating a project whose source.buildspec is set to "" or whitespace; a source checkout whose buildspec.yml exists but is empty (0 bytes or only whitespace), which Floci reads and passes to the parser.
Common situations: Templates or CDK constructs that interpolate a buildspec variable that is unset; CI pipelines that generate buildspec.yml dynamically and emit an empty file on failure; passing the wrong field (e.g. buildspecVersion) so the intended content never reaches the parser.
Related errors
- InvalidInputException
- InvalidInputException
- TLS enabled but no certificate provided and self-signed gene
- ValidationException
- Override %s must not contain control characters.
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/db708086b67ad752.
Report an issue: GitHub.