{"id":"94c914aa35b53f6d","repo":"docker/cli","slug":"hook-template-contains-too-many-messages-d-max","errorCode":null,"errorMessage":"hook template contains too many messages (%d): maximum is %d","messagePattern":"hook template contains too many messages \\((.+?)\\): maximum is (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli-plugins/hooks/template.go","lineNumber":44,"sourceCode":"\t\t\t\"flagValue\": msgContext.flagValue,\n\t\t\t\"argValue\":  msgContext.argValue,\n\n\t\t\t// kept for backward-compatibility with old templates.\n\t\t\t\"flag\": func(_ any, flagName string) (string, error) { return msgContext.flagValue(flagName) },\n\t\t\t\"arg\":  func(_ any, i int) (string, error) { return msgContext.argValue(i) },\n\t\t}).Parse(hookTemplate)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar b bytes.Buffer\n\t\terr = tmpl.Execute(&b, msgContext)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout = b.String()\n\t}\n\tif n := strings.Count(out, \"\\n\"); n > maxMessages {\n\t\treturn nil, fmt.Errorf(\"hook template contains too many messages (%d): maximum is %d\", n, maxMessages)\n\t}\n\treturn strings.SplitN(out, \"\\n\", maxMessages), nil\n}\n\nvar ErrHookTemplateParse = errors.New(\"failed to parse hook template\")\n\n// commandInfo provides info about the command for which the hook was invoked.\n// It is used for templated hook-messages.\ntype commandInfo struct {\n\tcmd *cobra.Command\n}\n\n// Name returns the name of the (sub)command for which the hook was invoked.\n//\n// It's used for backward-compatibility with old templates.\nfunc (c commandInfo) Name() string {\n\treturn c.command()\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli-plugins/hooks/template.go#L26-L62","documentation":"Error \"hook template contains too many messages (%d): maximum is %d\" thrown in docker/cli.","triggerScenarios":"Thrown at cli-plugins/hooks/template.go:44 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}