{"record":{"id":"0b3aba081fc1abb3","repo":"microsoft/aspire","slug":"no-input-with-name-s-was-found","errorCode":null,"errorMessage":"no input with name '%s' was found","messagePattern":"no input with name '(.+?)' was found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.CodeGeneration.Go/AtsGoCodeGenerator.cs","lineNumber":997,"sourceCode":"        // These delegate to ToArray (a single RPC) and then match locally. Names are compared\n        // case-insensitively via strings.EqualFold to mirror StringComparers.InteractionInputName in .NET.\n        WriteLine(\"// Get returns the input with the specified name, or nil if no input matches.\");\n        WriteLine($\"func (s *{implName}) Get(name string) (*InteractionInput, error) {{\");\n        WriteLine(\"\\tif s.err != nil { return nil, s.err }\");\n        WriteLine(\"\\tinputs, err := s.ToArray()\");\n        WriteLine(\"\\tif err != nil { return nil, err }\");\n        WriteLine(\"\\tfor _, input := range inputs {\");\n        WriteLine(\"\\t\\tif strings.EqualFold(input.Name, name) { return input, nil }\");\n        WriteLine(\"\\t}\");\n        WriteLine(\"\\treturn nil, nil\");\n        WriteLine(\"}\");\n        WriteLine();\n\n        WriteLine(\"// Required returns the input with the specified name, or an error if no input matches.\");\n        WriteLine($\"func (s *{implName}) Required(name string) (*InteractionInput, error) {{\");\n        WriteLine(\"\\tinput, err := s.Get(name)\");\n        WriteLine(\"\\tif err != nil { return nil, err }\");\n        WriteLine(\"\\tif input == nil { return nil, fmt.Errorf(\\\"no input with name '%s' was found\\\", name) }\");\n        WriteLine(\"\\treturn input, nil\");\n        WriteLine(\"}\");\n        WriteLine();\n\n        WriteLine(\"// Value returns the value of the input with the specified name, or an empty string if no input matches or it has no value.\");\n        WriteLine($\"func (s *{implName}) Value(name string) (string, error) {{\");\n        WriteLine(\"\\tinput, err := s.Get(name)\");\n        WriteLine(\"\\tif err != nil { return \\\"\\\", err }\");\n        WriteLine(\"\\tif input == nil || input.Value == nil { return \\\"\\\", nil }\");\n        WriteLine(\"\\treturn *input.Value, nil\");\n        WriteLine(\"}\");\n        WriteLine();\n\n        WriteLine(\"// RequiredValue returns the value of the input with the specified name, or an error if no input matches.\");\n        WriteLine($\"func (s *{implName}) RequiredValue(name string) (string, error) {{\");\n        WriteLine(\"\\tinput, err := s.Required(name)\");\n        WriteLine(\"\\tif err != nil { return \\\"\\\", err }\");\n        WriteLine(\"\\tif input.Value == nil { return \\\"\\\", nil }\");","sourceCodeStart":979,"sourceCodeEnd":1015,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.CodeGeneration.Go/AtsGoCodeGenerator.cs#L979-L1015","documentation":"Generated Go ATS wrapper code's Required(name) method looks up an interaction input by name; if Get succeeds but the input is absent (or nil), it returns this error. It exists to distinguish 'the name exists but is empty' from a successful lookup, guaranteeing Required never returns a nil input.","triggerScenarios":"Calling a generated Required(\"name\") method on the interaction-inputs struct with a name that was never declared among the capability's inputs, or whose lookup returned a nil entry.","commonSituations":"Typo in the input name, renaming/removing an input on the C# side while the generated Go client is stale, or consuming a required input that is only conditionally defined.","solutions":["Correct the input name string to match a declared input exactly (names are case-sensitive)","Regenerate the Go client from the current AppHost so the inputs struct is in sync with the capability definition","Use Get/Value instead of Required if the input is genuinely optional"],"exampleFix":"// before\nval, err := inputs.Required(\"ConenctionString\") // typo\n// after\nval, err := inputs.Required(\"ConnectionString\")","handlingStrategy":"try-catch","validationCode":"// Check availability first\nif v, err := inputs.Get(\"ConnectionString\"); err != nil || v == nil {\n\t// handle missing input before calling Required\n}","typeGuard":"func inputExists(inputs *InteractionInputs, name string) bool { v, _ := inputs.Get(name); return v != nil }","tryCatchPattern":"val, err := inputs.Required(\"ConnectionString\")\nif err != nil {\n\treturn fmt.Errorf(\"missing required input: %w\", err)\n}","preventionTips":["Copy input names from the generated source rather than typing them","Regenerate the Go client whenever the AppHost inputs change","Only use Required for inputs that are unconditionally declared"],"tags":["go","code-generation","input-not-found","ats"],"backgroundTag":"missing-required-argument","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"}