{"record":{"id":"47055c1c4030d390","repo":"floci-io/floci","slug":"invalidinputexception-47055c","errorCode":"InvalidInputException","errorMessage":"source.type is required","messagePattern":"source\\.type is required","errorType":"exception","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildService.java","lineNumber":139,"sourceCode":"                                 ProjectSource source, List<ProjectSource> secondarySources,\n                                 String sourceVersion,\n                                 ProjectArtifacts artifacts, List<ProjectArtifacts> secondaryArtifacts,\n                                 ProjectEnvironment environment,\n                                 String serviceRole,\n                                 Integer timeoutInMinutes, Integer queuedTimeoutInMinutes,\n                                 String encryptionKey,\n                                 List<Map<String, String>> tags,\n                                 Map<String, Object> logsConfig,\n                                 Map<String, Object> vpcConfig,\n                                 Integer concurrentBuildLimit) {\n        Map<String, Project> store = projectsFor(region);\n        if (store.containsKey(name)) {\n            throw new AwsException(\"ResourceAlreadyExistsException\",\n                    \"Project already exists: \" + name, 400);\n        }\n        validateProjectName(name);\n        if (source == null || source.getType() == null) {\n            throw new AwsException(\"InvalidInputException\", \"source.type is required\", 400);\n        }\n        if (environment == null) {\n            throw new AwsException(\"InvalidInputException\", \"environment is required\", 400);\n        }\n        if (serviceRole == null || serviceRole.isBlank()) {\n            throw new AwsException(\"InvalidInputException\", \"serviceRole is required\", 400);\n        }\n        if (artifacts == null || artifacts.getType() == null) {\n            throw new AwsException(\"InvalidInputException\", \"artifacts.type is required\", 400);\n        }\n\n        double now = Instant.now().toEpochMilli() / 1000.0;\n        Project project = new Project();\n        project.setName(name);\n        project.setArn(AwsArnUtils.Arn.of(\"codebuild\", region, account, \"project/\" + name).toString());\n        project.setDescription(description);\n        project.setSource(source);\n        project.setSecondarySources(secondarySources);","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildService.java#L121-L157","documentation":"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.","triggerScenarios":"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.","commonSituations":"Building the CreateProjectRequest programmatically and forgetting setSource(); minimal CLI payloads copied from partial examples; NO_SOURCE users wrongly assuming source can be omitted.","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"],"exampleFix":"# before\n{ \"name\": \"demo\", \"environment\": {...}, \"serviceRole\": \"...\", \"artifacts\": {\"type\": \"NO_ARTIFACTS\"} }\n\n# after\n{ \"name\": \"demo\", \"source\": {\"type\": \"NO_SOURCE\"}, \"environment\": {...}, \"serviceRole\": \"...\", \"artifacts\": {\"type\": \"NO_ARTIFACTS\"} }","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Java - request is createable only when source type is set\nstatic boolean isCreatable(CreateProjectRequest r) {\n    return r.source() != null && r.source().type() != null;\n}","tryCatchPattern":"catch (InvalidInputException e) {\n    if (\"source.type is required\".equals(e.getMessage())) {\n        request = request.toBuilder().source(Source.builder().type(SourceType.NO_SOURCE).build()).build();\n        codebuild.createProject(request);\n    } else throw e;\n}","preventionTips":["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"],"tags":["codebuild","create-project","validation","source"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}