floci-io/floci · error · AwsException
InvalidInputException
InvalidInputException
Error message
source.type is required
What it means
Thrown by CodeBuildService.createProject when the source argument is null or its type field is null. CodeBuild requires every project to declare a source type (e.g. GITHUB, CODECOMMIT, S3, NO_SOURCE). Returned as InvalidInputException 400.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildService.java:139
ProjectSource source, List<ProjectSource> secondarySources,
String sourceVersion,
ProjectArtifacts artifacts, List<ProjectArtifacts> secondaryArtifacts,
ProjectEnvironment environment,
String serviceRole,
Integer timeoutInMinutes, Integer queuedTimeoutInMinutes,
String encryptionKey,
List<Map<String, String>> tags,
Map<String, Object> logsConfig,
Map<String, Object> vpcConfig,
Integer concurrentBuildLimit) {
Map<String, Project> store = projectsFor(region);
if (store.containsKey(name)) {
throw new AwsException("ResourceAlreadyExistsException",
"Project already exists: " + name, 400);
}
validateProjectName(name);
if (source == null || source.getType() == null) {
throw new AwsException("InvalidInputException", "source.type is required", 400);
}
if (environment == null) {
throw new AwsException("InvalidInputException", "environment is required", 400);
}
if (serviceRole == null || serviceRole.isBlank()) {
throw new AwsException("InvalidInputException", "serviceRole is required", 400);
}
if (artifacts == null || artifacts.getType() == null) {
throw new AwsException("InvalidInputException", "artifacts.type is required", 400);
}
double now = Instant.now().toEpochMilli() / 1000.0;
Project project = new Project();
project.setName(name);
project.setArn(AwsArnUtils.Arn.of("codebuild", region, account, "project/" + name).toString());
project.setDescription(description);
project.setSource(source);
project.setSecondarySources(secondarySources);View on GitHub (pinned to 62ff490619)
Solutions
- Include a source object with a type, e.g. {"type": "NO_SOURCE"} when there is no repo
- If using the AWS SDK v2, call request.source(Source.builder().type(SourceType.NO_SOURCE).build())
- Validate the payload against the AWS CodeBuild CreateProject schema before sending
Example fix
# before
{ "name": "demo", "environment": {...}, "serviceRole": "...", "artifacts": {"type": "NO_ARTIFACTS"} }
# after
{ "name": "demo", "source": {"type": "NO_SOURCE"}, "environment": {...}, "serviceRole": "...", "artifacts": {"type": "NO_ARTIFACTS"} } Defensive patterns
Strategy: type-guard
Type guard
// Java - request is createable only when source type is set
static boolean isCreatable(CreateProjectRequest r) {
return r.source() != null && r.source().type() != null;
} Try / catch
catch (InvalidInputException e) {
if ("source.type is required".equals(e.getMessage())) {
request = request.toBuilder().source(Source.builder().type(SourceType.NO_SOURCE).build()).build();
codebuild.createProject(request);
} else throw e;
} Prevention
- Always set source.type, using NO_SOURCE when there is no repo
- Validate required CreateProject fields (source, environment, serviceRole, artifacts) in one pre-send check
When it happens
Trigger: CreateProject JSON body omitting the source object entirely; source present but missing the type key; source.type serialized as null by a SDK model where the field was never set.
Common situations: Building the CreateProjectRequest programmatically and forgetting setSource(); minimal CLI payloads copied from partial examples; NO_SOURCE users wrongly assuming source can be omitted.
Related errors
- InvalidInputException
- InvalidInputException
- ResourceAlreadyExistsException
- TLS enabled but no certificate provided and self-signed gene
- ValidationException
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/47055c1c4030d390.
Report an issue: GitHub.