microsoft/aspire · error · IllegalArgumentException (in generated Java code)

no input with name '" + name + "' was found

Error message

no input with name '" + name + "' was found

What it means

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.

Solutions

  1. Use the generated get(name) accessor (returns null) and handle absence instead of required().
  2. Verify the exact input name against the interaction definition (names are case-sensitive).
  3. Regenerate the SDK so the expected input names match the current interaction schema.
  4. Catch IllegalArgumentException around required() and treat it as a missing-input condition.

Example fix

// before
String region = inputs.required("Region");
// after
InteractionInput input = inputs.get("Region");
String region = input != null && input.getValue() != null ? input.getValue().toString() : "eastus";
Defensive patterns

Strategy: validation

Validate before calling

// Java: check presence before required()
if (inputs.get("Region") == null) {
    throw new IllegalStateException("Interaction did not collect required input 'Region'");
}

Type guard

// Java
static boolean hasInput(Inputs inputs, String name) {
    return inputs.get(name) != null;
}

Try / catch

try {
    region = inputs.required("Region");
} catch (IllegalArgumentException e) {
    logger.warn("Missing input: {}", e.getMessage());
    region = defaultValue;
}

Prevention

When it happens

Trigger: Calling the generated InteractionInput container's required(name) method with a name that is not among the inputs returned from the interaction/prompt collection.

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/5f1ac2e033a53b3a. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs:1299

    private void GenerateInteractionInputCollectionAccessors()
    {
        // These accessors are hand-authored on top of the generated toArray capability for parity with .NET and TypeScript.
        WriteLine("    /** Gets the input with the specified name, or null if no input matches. */");
        WriteLine("    public InteractionInput get(String name) {");
        WriteLine("        for (var input : toArray()) {");
        WriteLine("            if (input.getName() != null && input.getName().equalsIgnoreCase(name)) {");
        WriteLine("                return input;");
        WriteLine("            }");
        WriteLine("        }");
        WriteLine("        return null;");
        WriteLine("    }");
        WriteLine();

        WriteLine("    /** Gets the input with the specified name, or throws if no input matches. */");
        WriteLine("    public InteractionInput required(String name) {");
        WriteLine("        var input = get(name);");
        WriteLine("        if (input == null) {");
        WriteLine("            throw new IllegalArgumentException(\"no input with name '\" + name + \"' was found\");");
        WriteLine("        }");
        WriteLine("        return input;");
        WriteLine("    }");
        WriteLine();

        WriteLine("    /** Gets the value of the input with the specified name, or an empty string if no input matches or it has no value. */");
        WriteLine("    public String value(String name) {");
        WriteLine("        var input = get(name);");
        WriteLine("        return input == null || input.getValue() == null ? \"\" : input.getValue();");
        WriteLine("    }");
        WriteLine();

        WriteLine("    /** Gets the value of the input with the specified name, or throws if no input matches. */");
        WriteLine("    public String requiredValue(String name) {");
        WriteLine("        return required(name).getValue();");
        WriteLine("    }");
        WriteLine();
    }

View on GitHub (pinned to 25830f84bd)