{"id":"f9f7a4073d11c984","repo":"docker/cli","slug":"invalid-type-t-for-duration","errorCode":null,"errorMessage":"invalid type %T for duration","messagePattern":"invalid type %T for duration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/loader/loader.go","lineNumber":915,"sourceCode":"\tswitch value := value.(type) {\n\tcase int:\n\t\treturn int64(value), nil\n\tcase string:\n\t\treturn units.RAMInBytes(value)\n\t}\n\tpanic(fmt.Errorf(\"invalid type for size %T\", value))\n}\n\nvar transformStringToDuration TransformerFunc = func(value any) (any, error) {\n\tswitch value := value.(type) {\n\tcase string:\n\t\td, err := time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn value, err\n\t\t}\n\t\treturn types.Duration(d), nil\n\tdefault:\n\t\treturn value, fmt.Errorf(\"invalid type %T for duration\", value)\n\t}\n}\n\nfunc toServicePortConfigs(value string) ([]any, error) {\n\t// short syntax ([ip:]public:private[/proto])\n\t//\n\t// TODO(thaJeztah): we need an equivalent that handles the \"ip-address\" part without depending on the nat package.\n\tports, portBindings, err := nat.ParsePortSpecs([]string{value})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// We need to sort the key of the ports to make sure it is consistent\n\tkeys := make([]string, 0, len(ports))\n\tfor port := range ports {\n\t\tkeys = append(keys, string(port))\n\t}\n\tsort.Strings(keys)\n","sourceCodeStart":897,"sourceCodeEnd":933,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/loader/loader.go#L897-L933","documentation":"Error \"invalid type %T for duration\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/compose/loader/loader.go:915 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}