{"record":{"id":"0a7775912cd2bb9b","repo":"microsoft/aspire","slug":"no-input-with-name-name-was-found-atspythoncodegenerator","errorCode":null,"errorMessage":"no input with name '{name}' was found","messagePattern":"no input with name '(.+?)' was found","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs","lineNumber":1176,"sourceCode":"    }\n\n    private static void EmitInteractionInputCollectionAccessors(System.Text.StringBuilder sb)\n    {\n        sb.AppendLine(\"    def get(self, name: str) -> InteractionInput | None:\");\n        sb.AppendLine(\"        \\\"\\\"\\\"Get the input with the specified name, or None if no input matches.\\\"\\\"\\\"\");\n        sb.AppendLine(\"        lookup_name = name.lower()\");\n        sb.AppendLine(\"        for interaction_input in self.to_array():\");\n        sb.AppendLine(\"            input_name = interaction_input.get(\\\"Name\\\")\");\n        sb.AppendLine(\"            if input_name is not None and input_name.lower() == lookup_name:\");\n        sb.AppendLine(\"                return interaction_input\");\n        sb.AppendLine(\"        return None\");\n        sb.AppendLine();\n\n        sb.AppendLine(\"    def required(self, name: str) -> InteractionInput:\");\n        sb.AppendLine(\"        \\\"\\\"\\\"Get the input with the specified name, or raise ValueError if no input matches.\\\"\\\"\\\"\");\n        sb.AppendLine(\"        interaction_input = self.get(name)\");\n        sb.AppendLine(\"        if interaction_input is None:\");\n        sb.AppendLine(\"            raise ValueError(f\\\"no input with name '{name}' was found\\\")\");\n        sb.AppendLine(\"        return interaction_input\");\n        sb.AppendLine();\n\n        sb.AppendLine(\"    def value(self, name: str) -> str:\");\n        sb.AppendLine(\"        \\\"\\\"\\\"Get the input value with the specified name, or an empty string if no input matches.\\\"\\\"\\\"\");\n        sb.AppendLine(\"        interaction_input = self.get(name)\");\n        sb.AppendLine(\"        if interaction_input is None:\");\n        sb.AppendLine(\"            return \\\"\\\"\");\n        sb.AppendLine(\"        return interaction_input.get(\\\"Value\\\") or \\\"\\\"\");\n        sb.AppendLine();\n\n        sb.AppendLine(\"    def required_value(self, name: str) -> str:\");\n        sb.AppendLine(\"        \\\"\\\"\\\"Get the input value with the specified name, or raise ValueError if no input matches.\\\"\\\"\\\"\");\n        sb.AppendLine(\"        return self.required(name).get(\\\"Value\\\") or \\\"\\\"\");\n        sb.AppendLine();\n    }\n\n    /// <summary>","sourceCodeStart":1158,"sourceCodeEnd":1194,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs#L1158-L1194","documentation":"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.","triggerScenarios":"Calling `interaction_input.required('someName')` on a generated Python object where 'someName' is not among the declared inputs (typo, renamed input, stale generated module).","commonSituations":"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.","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."],"exampleFix":"# before\nstop_reason = result.required(\"stop_reson\")  # typo\n# after\nstop_reason = result.required(\"stop_reason\")","handlingStrategy":"try-catch","validationCode":"if interaction_input.get(name) is None:\n    raise ValueError(f\"no input with name '{name}' was found\")","typeGuard":null,"tryCatchPattern":"try:\n    value = result.required(name)\nexcept ValueError:\n    value = None  # or regenerate/list available inputs","preventionTips":["Regenerate Python client code after renaming inputs.","Use get() when absence is acceptable.","Check declared input names before calling required()."],"tags":["python","generated-code","value-error","lookup"],"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"}