{"id":"ee2535efa9ce40d0","repo":"labstack/echo","slug":"s-w","errorCode":null,"errorMessage":"%s: %w","messagePattern":"%s: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bind.go","lineNumber":322,"sourceCode":"\t\t\t\tif strings.EqualFold(k, inputFieldName) {\n\t\t\t\t\tinputValue = v\n\t\t\t\t\texists = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif !exists {\n\t\t\tcontinue\n\t\t}\n\n\t\t// NOTE: algorithm here is not particularly sophisticated. It probably does not work with absurd types like `**[]*int`\n\t\t// but it is smart enough to handle niche cases like `*int`,`*[]string`,`[]*int` .\n\n\t\t// try unmarshalling first, in case we're dealing with an alias to an array type\n\t\tif ok, err := unmarshalInputsToField(fm.fieldKind, inputValue, structField); ok {\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s: %w\", inputFieldName, err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif ok, err := unmarshalInputToField(fm.fieldKind, inputValue[0], structField, fm.formatTag); ok {\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s: %w\", inputFieldName, err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// we could be dealing with pointer to slice `*[]string` so dereference it. There are weird OpenAPI generators\n\t\t// that could create struct fields like that.\n\t\tif structFieldKind == reflect.Pointer {\n\t\t\tstructFieldKind = structField.Elem().Kind()\n\t\t\tstructField = structField.Elem()\n\t\t}\n","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/labstack/echo/blob/05489dc1730161df26b72d1ae2a3ba6fb8178fc7/bind.go#L304-L340","documentation":"A wrapping error (fmt.Errorf with %w) from bindData at line 322, produced when unmarshalInputsToField fails. This path handles fields implementing the bindMultipleUnmarshaler interface (UnmarshalParams([]string) error) and their UnmarshalParams call returned an error. The field name is prefixed (e.g. \"tags: <inner error>\") so the caller knows which field failed, and the inner error is wrapped for errors.Is/As.","triggerScenarios":"Binding multiple query/form values (e.g. ?tag=a&tag=b) into a field whose type implements UnmarshalParams([]string) error, and the implementation returns an error such as invalid format, too many values, or domain validation failure.","commonSituations":"Custom slice or collection types with an UnmarshalParams implementation enforcing constraints (max items, allowed values). Custom enum or time types parsing multiple inputs.","solutions":["Inspect the wrapped error via errors.Unwrap/errors.Is to determine the exact parse failure","Fix the client input to match the expected format for that field","Make the UnmarshalParams implementation more lenient or return a clearer error message"],"exampleFix":"// custom type returning error from UnmarshalParams\ntype Tags []string\nfunc (t *Tags) UnmarshalParams(vals []string) error {\n    if len(vals) > 5 { return errors.New(\"max 5 tags\") }\n    *t = vals\n    return nil\n}\n// error returned: \"tags: max 5 tags\"\n// fix: send <= 5 tags, or raise the limit in UnmarshalParams","handlingStrategy":"try-catch","validationCode":"// Validate multi-value params before they reach UnmarshalParams\nfunc validateSliceValues(vals []string, max int) error {\n    if len(vals) > max {\n        return fmt.Errorf(\"too many values: %d > %d\", len(vals), max)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := c.Bind(&req); err != nil {\n    var he *echo.HTTPError\n    if errors.As(err, &he) || strings.Contains(err.Error(), \":\") {\n        // field-level bind error; extract field name from prefix\n        fieldName := strings.SplitN(err.Error(), \":\", 2)[0]\n        return echo.NewHTTPError(http.StatusBadRequest, \"invalid value for \"+fieldName)\n    }\n    return err\n}","preventionTips":["Make UnmarshalParams implementations return clear, specific error messages","Validate input length and format early in UnmarshalParams","Document the expected multi-value format in your API spec"],"tags":["binding","unmarshaler","error-wrapping","multiple-values"],"analyzedSha":"05489dc1730161df26b72d1ae2a3ba6fb8178fc7","analyzedAt":"2026-08-04T21:32:47.783Z","schemaVersion":2}