{"record":{"id":"5f1ac2e033a53b3a","repo":"microsoft/aspire","slug":"no-input-with-name-name-was-found","errorCode":null,"errorMessage":"no input with name '\" + name + \"' was found","messagePattern":"no input with name '\" \\+ name \\+ \"' was found","errorType":"exception","errorClass":"IllegalArgumentException (in generated Java code)","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs","lineNumber":1299,"sourceCode":"    private void GenerateInteractionInputCollectionAccessors()\n    {\n        // These accessors are hand-authored on top of the generated toArray capability for parity with .NET and TypeScript.\n        WriteLine(\"    /** Gets the input with the specified name, or null if no input matches. */\");\n        WriteLine(\"    public InteractionInput get(String name) {\");\n        WriteLine(\"        for (var input : toArray()) {\");\n        WriteLine(\"            if (input.getName() != null && input.getName().equalsIgnoreCase(name)) {\");\n        WriteLine(\"                return input;\");\n        WriteLine(\"            }\");\n        WriteLine(\"        }\");\n        WriteLine(\"        return null;\");\n        WriteLine(\"    }\");\n        WriteLine();\n\n        WriteLine(\"    /** Gets the input with the specified name, or throws if no input matches. */\");\n        WriteLine(\"    public InteractionInput required(String name) {\");\n        WriteLine(\"        var input = get(name);\");\n        WriteLine(\"        if (input == null) {\");\n        WriteLine(\"            throw new IllegalArgumentException(\\\"no input with name '\\\" + name + \\\"' was found\\\");\");\n        WriteLine(\"        }\");\n        WriteLine(\"        return input;\");\n        WriteLine(\"    }\");\n        WriteLine();\n\n        WriteLine(\"    /** Gets the value of the input with the specified name, or an empty string if no input matches or it has no value. */\");\n        WriteLine(\"    public String value(String name) {\");\n        WriteLine(\"        var input = get(name);\");\n        WriteLine(\"        return input == null || input.getValue() == null ? \\\"\\\" : input.getValue();\");\n        WriteLine(\"    }\");\n        WriteLine();\n\n        WriteLine(\"    /** Gets the value of the input with the specified name, or throws if no input matches. */\");\n        WriteLine(\"    public String requiredValue(String name) {\");\n        WriteLine(\"        return required(name).getValue();\");\n        WriteLine(\"    }\");\n        WriteLine();\n    }","sourceCodeStart":1281,"sourceCodeEnd":1317,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs#L1281-L1317","documentation":"Generated Java source emitted by AtsJavaCodeGenerator for the interaction-input lookup class: the required(String name) helper throws IllegalArgumentException(\"no input with name '\" + name + \"' was found\") at Java runtime when get(name) returns null — i.e., the collected inputs contain no entry with that name.","triggerScenarios":"Calling the generated InteractionInput container's required(name) method with a name that is not among the inputs returned from the interaction/prompt collection.","commonSituations":"Caller expects an input the user never filled in; input name typo or case mismatch; interaction schema changed and an input was renamed/removed; optional inputs skipped during collection but accessed as required.","solutions":["Use the generated get(name) accessor (returns null) and handle absence instead of required().","Verify the exact input name against the interaction definition (names are case-sensitive).","Regenerate the SDK so the expected input names match the current interaction schema.","Catch IllegalArgumentException around required() and treat it as a missing-input condition."],"exampleFix":"// before\nString region = inputs.required(\"Region\");\n// after\nInteractionInput input = inputs.get(\"Region\");\nString region = input != null && input.getValue() != null ? input.getValue().toString() : \"eastus\";","handlingStrategy":"validation","validationCode":"// Java: check presence before required()\nif (inputs.get(\"Region\") == null) {\n    throw new IllegalStateException(\"Interaction did not collect required input 'Region'\");\n}","typeGuard":"// Java\nstatic boolean hasInput(Inputs inputs, String name) {\n    return inputs.get(name) != null;\n}","tryCatchPattern":"try {\n    region = inputs.required(\"Region\");\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Missing input: {}\", e.getMessage());\n    region = defaultValue;\n}","preventionTips":["Use get(name) with null handling for optional inputs; reserve required() for truly mandatory ones.","Validate interaction input names against the schema after regeneration.","Log the available input names when a lookup misses to ease diagnosis."],"tags":["java","code-generation","input-lookup","missing-value"],"backgroundTag":"record-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}