{"id":"9b6dbd6117dd527c","repo":"docker/cli","slug":"failed-to-parse-hook-template-flagvalue-no-flags","errorCode":null,"errorMessage":"failed to parse hook template: flagValue: no flags found","messagePattern":"failed to parse hook template: flagValue: no flags found","errorType":"exception","errorClass":"ErrHookTemplateParse","httpStatus":null,"severity":"error","filePath":"cli-plugins/hooks/template.go","lineNumber":79,"sourceCode":"\treturn c.command()\n}\n\n// command returns the name of the (sub)command for which the hook was invoked.\nfunc (c commandInfo) command() string {\n\tif c.cmd == nil {\n\t\treturn \"\"\n\t}\n\treturn c.cmd.Name()\n}\n\n// flagValue returns the value that was set for the given flag when the hook was invoked.\nfunc (c commandInfo) flagValue(flagName string) (string, error) {\n\tif c.cmd == nil {\n\t\treturn \"\", fmt.Errorf(\"%w: flagValue: cmd is nil\", ErrHookTemplateParse)\n\t}\n\tf := c.cmd.Flag(flagName)\n\tif f == nil {\n\t\treturn \"\", fmt.Errorf(\"%w: flagValue: no flags found\", ErrHookTemplateParse)\n\t}\n\treturn f.Value.String(), nil\n}\n\n// argValue returns the value of the nth argument.\nfunc (c commandInfo) argValue(n int) (string, error) {\n\tif c.cmd == nil {\n\t\treturn \"\", fmt.Errorf(\"%w: arg: cmd is nil\", ErrHookTemplateParse)\n\t}\n\tflags := c.cmd.Flags()\n\tv := flags.Arg(n)\n\tif v == \"\" && n >= flags.NArg() {\n\t\treturn \"\", fmt.Errorf(\"%w: arg: %dth argument not set\", ErrHookTemplateParse, n)\n\t}\n\treturn v, nil\n}\n","sourceCodeStart":61,"sourceCodeEnd":96,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli-plugins/hooks/template.go#L61-L96","documentation":"Error \"failed to parse hook template: flagValue: no flags found\" thrown in docker/cli.","triggerScenarios":"Thrown at cli-plugins/hooks/template.go:79 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}