microsoft/aspire · error · ValueError

no input with name ' ' was found

Error message

no input with name '{name}' was found

What it means

This ValueError is emitted by the `required(name)` method that AtsPythonCodeGenerator writes into generated Python interaction-input classes: it fires when no input with the given name exists (self.get(name) returned None). It's a defensive lookup error in generated code, not thrown by the C# generator itself.

Solutions

  1. Regenerate the Python client code so it matches the current AppHost inputs.
  2. Fix the name passed to required() (check available names via get()/declared inputs).
  3. Use the non-throwing get(name) and handle None if absence is acceptable.
  4. Verify the resource definition declares the input you are requesting.

Example fix

# before
stop_reason = result.required("stop_reson")  # typo
# after
stop_reason = result.required("stop_reason")
Defensive patterns

Strategy: try-catch

Validate before calling

if interaction_input.get(name) is None:
    raise ValueError(f"no input with name '{name}' was found")

Try / catch

try:
    value = result.required(name)
except ValueError:
    value = None  # or regenerate/list available inputs

Prevention

When it happens

Trigger: Calling `interaction_input.required('someName')` on a generated Python object where 'someName' is not among the declared inputs (typo, renamed input, stale generated module).

Common situations: Renaming an input in the AppHost and not regenerating Python client code; typos in input names; using a name that only exists on another resource type.

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/0a7775912cd2bb9b. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs:1176

    }

    private static void EmitInteractionInputCollectionAccessors(System.Text.StringBuilder sb)
    {
        sb.AppendLine("    def get(self, name: str) -> InteractionInput | None:");
        sb.AppendLine("        \"\"\"Get the input with the specified name, or None if no input matches.\"\"\"");
        sb.AppendLine("        lookup_name = name.lower()");
        sb.AppendLine("        for interaction_input in self.to_array():");
        sb.AppendLine("            input_name = interaction_input.get(\"Name\")");
        sb.AppendLine("            if input_name is not None and input_name.lower() == lookup_name:");
        sb.AppendLine("                return interaction_input");
        sb.AppendLine("        return None");
        sb.AppendLine();

        sb.AppendLine("    def required(self, name: str) -> InteractionInput:");
        sb.AppendLine("        \"\"\"Get the input with the specified name, or raise ValueError if no input matches.\"\"\"");
        sb.AppendLine("        interaction_input = self.get(name)");
        sb.AppendLine("        if interaction_input is None:");
        sb.AppendLine("            raise ValueError(f\"no input with name '{name}' was found\")");
        sb.AppendLine("        return interaction_input");
        sb.AppendLine();

        sb.AppendLine("    def value(self, name: str) -> str:");
        sb.AppendLine("        \"\"\"Get the input value with the specified name, or an empty string if no input matches.\"\"\"");
        sb.AppendLine("        interaction_input = self.get(name)");
        sb.AppendLine("        if interaction_input is None:");
        sb.AppendLine("            return \"\"");
        sb.AppendLine("        return interaction_input.get(\"Value\") or \"\"");
        sb.AppendLine();

        sb.AppendLine("    def required_value(self, name: str) -> str:");
        sb.AppendLine("        \"\"\"Get the input value with the specified name, or raise ValueError if no input matches.\"\"\"");
        sb.AppendLine("        return self.required(name).get(\"Value\") or \"\"");
        sb.AppendLine();
    }

    /// <summary>

View on GitHub (pinned to 25830f84bd)