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
- Regenerate the Python client code so it matches the current AppHost inputs.
- Fix the name passed to required() (check available names via get()/declared inputs).
- Use the non-throwing get(name) and handle None if absence is acceptable.
- 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
- Regenerate Python client code after renaming inputs.
- Use get() when absence is acceptable.
- Check declared input names before calling required().
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
- Invalid ReferenceExpression: must have either handle…
- Unexpected keyword arguments
- Array params contains empty item
- Array params contains null item
- ASPIRE_REMOTE_APPHOST_TOKEN environment variable not set…
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)