{"id":"5fe33684ea3f0bd1","repo":"docker/cli","slug":"expected-func-got-v","errorCode":null,"errorMessage":"expected func, got %v","messagePattern":"expected func, got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/formatter/reflect.go","lineNumber":57,"sourceCode":"\tfor i := 0; i < val.NumMethod(); i++ {\n\t\tk, v, err := marshalForMethod(typ.Method(i), val.Method(i))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif k != \"\" {\n\t\t\tm[k] = v\n\t\t}\n\t}\n\treturn m, nil\n}\n\nvar unmarshallableNames = map[string]struct{}{\"FullHeader\": {}}\n\n// marshalForMethod returns the map key and the map value for marshalling the method.\n// It returns (\"\", nil, nil) for valid but non-marshallable parameter. (e.g. \"unexportedFunc()\")\nfunc marshalForMethod(typ reflect.Method, val reflect.Value) (string, any, error) {\n\tif val.Kind() != reflect.Func {\n\t\treturn \"\", nil, fmt.Errorf(\"expected func, got %v\", val.Kind())\n\t}\n\tname, numIn, numOut := typ.Name, val.Type().NumIn(), val.Type().NumOut()\n\t_, blackListed := unmarshallableNames[name]\n\t// FIXME: In text/template, (numOut == 2) is marshallable,\n\t//        if the type of the second param is error.\n\tmarshallable := unicode.IsUpper(rune(name[0])) && !blackListed &&\n\t\tnumIn == 0 && numOut == 1\n\tif !marshallable {\n\t\treturn \"\", nil, nil\n\t}\n\tresult := val.Call(make([]reflect.Value, numIn))\n\tintf := result[0].Interface()\n\treturn name, intf, nil\n}\n","sourceCodeStart":39,"sourceCodeEnd":72,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/formatter/reflect.go#L39-L72","documentation":"Error \"expected func, got %v\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/formatter/reflect.go:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}