{"id":"ab458ced7bd87826","repo":"docker/cli","slug":"failed-to-cast-to-expected-type-w","errorCode":null,"errorMessage":"failed to cast to expected type: %w","messagePattern":"failed to cast to expected type: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/interpolation/interpolation.go","lineNumber":71,"sourceCode":"\t}\n\n\treturn out, nil\n}\n\nfunc recursiveInterpolate(value any, path Path, opts Options) (any, error) {\n\tswitch value := value.(type) {\n\tcase string:\n\t\tnewValue, err := opts.Substitute(value, template.Mapping(opts.LookupValue))\n\t\tif err != nil || newValue == value {\n\t\t\treturn value, newPathError(path, err)\n\t\t}\n\t\tcaster, ok := opts.getCasterForPath(path)\n\t\tif !ok {\n\t\t\treturn newValue, nil\n\t\t}\n\t\tcasted, err := caster(newValue)\n\t\tif err != nil {\n\t\t\treturn casted, newPathError(path, fmt.Errorf(\"failed to cast to expected type: %w\", err))\n\t\t}\n\t\treturn casted, nil\n\n\tcase map[string]any:\n\t\tout := map[string]any{}\n\t\tfor key, elem := range value {\n\t\t\tinterpolatedElem, err := recursiveInterpolate(elem, path.Next(key), opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tout[key] = interpolatedElem\n\t\t}\n\t\treturn out, nil\n\n\tcase []any:\n\t\tout := make([]any, len(value))\n\t\tfor i, elem := range value {\n\t\t\tinterpolatedElem, err := recursiveInterpolate(elem, path.Next(PathMatchList), opts)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/interpolation/interpolation.go#L53-L89","documentation":"Error \"failed to cast to expected type: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/compose/interpolation/interpolation.go:71 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}