{"record":{"id":"7f0dd0ceae6906b3","repo":"floci-io/floci","slug":"invalidinput","errorCode":"InvalidInput","errorMessage":"Vpc is required for a private DNS namespace.","messagePattern":"Vpc is required for a private DNS namespace\\.","errorType":"exception","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/cloudmap/CloudMapService.java","lineNumber":94,"sourceCode":"    public Operation createHttpNamespace(String name, String creatorRequestId,\n                                         String description, Map<String, String> tags, String region) {\n        Namespace ns = newNamespace(name, \"HTTP\", description, creatorRequestId, tags, region);\n        namespaceStore.put(ns.getId(), ns);\n        return submitOperation(\"CREATE_NAMESPACE\", \"NAMESPACE\", ns.getId(), region);\n    }\n\n    public Operation createPublicDnsNamespace(String name, String creatorRequestId,\n                                              String description, Map<String, String> tags, String region) {\n        Namespace ns = newNamespace(name, \"DNS_PUBLIC\", description, creatorRequestId, tags, region);\n        ns.setHostedZoneId(generateHostedZoneId());\n        namespaceStore.put(ns.getId(), ns);\n        return submitOperation(\"CREATE_NAMESPACE\", \"NAMESPACE\", ns.getId(), region);\n    }\n\n    public Operation createPrivateDnsNamespace(String name, String vpc, String creatorRequestId,\n                                               String description, Map<String, String> tags, String region) {\n        if (vpc == null || vpc.isBlank()) {\n            throw new AwsException(\"InvalidInput\", \"Vpc is required for a private DNS namespace.\", 400);\n        }\n        Namespace ns = newNamespace(name, \"DNS_PRIVATE\", description, creatorRequestId, tags, region);\n        ns.setVpc(vpc);\n        ns.setHostedZoneId(generateHostedZoneId());\n        namespaceStore.put(ns.getId(), ns);\n        return submitOperation(\"CREATE_NAMESPACE\", \"NAMESPACE\", ns.getId(), region);\n    }\n\n    private Namespace newNamespace(String name, String type, String description,\n                                   String creatorRequestId, Map<String, String> tags, String region) {\n        if (name == null || name.isBlank()) {\n            throw new AwsException(\"InvalidInput\", \"Namespace name is required.\", 400);\n        }\n        boolean exists = scan(namespaceStore).stream()\n                .anyMatch(n -> region.equals(n.getRegion()) && name.equals(n.getName()));\n        if (exists) {\n            throw new AwsException(\"NamespaceAlreadyExists\",\n                    \"A namespace named \\\"\" + name + \"\\\" already exists.\", 400);","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/cloudmap/CloudMapService.java#L76-L112","documentation":"A private DNS namespace in Cloud Map is bound to a VPC, so CreatePrivateDnsNamespace requires a non-null, non-blank Vpc value. Floci checks this in createPrivateDnsNamespace and throws InvalidInput (HTTP 400) when the VPC argument is missing. AWS returns the same code for the same reason.","triggerScenarios":"CreatePrivateDnsNamespace (or the HTTP API POST /service-discovery namespace with Type=DNS_PRIVATE) with Vpc omitted, null, or whitespace. Note the public variant createPublicDnsNamespace takes no VPC, so switching namespace type without updating arguments is a common path here.","commonSituations":"Refactoring a public-namespace call into a private one and forgetting the VPC parameter; the SDK builder skipping .vpc(...) because it is optional in the model; wrong overload chosen at compile time.","solutions":["Pass the VPC ID (e.g. \"vpc-0123456789abcdef0\") in the CreatePrivateDnsNamespace request","If you do not need VPC-scoped DNS, use CreatePublicDnsNamespace instead","Validate the VPC ID exists in your EC2/emulator setup before creating the namespace"],"exampleFix":"// before\ncloudMapClient.createPrivateDnsNamespace(r -> r\n    .name(\"corp.example.internal\")\n    .creatorRequestId(\"ns-1\"));\n\n// after\ncloudMapClient.createPrivateDnsNamespace(r -> r\n    .name(\"corp.example.internal\")\n    .vpc(\"vpc-0123456789abcdef0\")\n    .creatorRequestId(\"ns-1\"));","handlingStrategy":"validation","validationCode":"if (vpcId == null || vpcId.isBlank()) {\n    throw new IllegalArgumentException(\"VPC id is required for a private DNS namespace\");\n}\ncloudMapClient.createPrivateDnsNamespace(r -> r.name(name).vpc(vpcId));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make the VPC id a mandatory parameter in your own provisioning API for private namespaces","Use CreatePublicDnsNamespace when no VPC scoping is intended"],"tags":["cloudmap","namespace","vpc","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}