{"record":{"id":"d25f0f8b7a243308","repo":"docker/compose","slug":"resolving-symlink-for-q-w","errorCode":null,"errorMessage":"resolving symlink for %q: %w","messagePattern":"resolving symlink for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/watch.go","lineNumber":408,"sourceCode":"\t\t\tlogrus.Debugf(\"batch complete: duration[%s] count[%d]\", time.Since(start), len(batch))\n\t\t}\n\t}\n}\n\nfunc loadDevelopmentConfig(service types.ServiceConfig, project *types.Project) (*types.DevelopConfig, error) {\n\tvar config types.DevelopConfig\n\ty, ok := service.Extensions[\"x-develop\"]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\tlogrus.Warnf(\"x-develop is DEPRECATED, please use the official `develop` attribute\")\n\terr := mapstructure.Decode(y, &config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseDir, err := filepath.EvalSymlinks(project.WorkingDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"resolving symlink for %q: %w\", project.WorkingDir, err)\n\t}\n\n\tfor i, trigger := range config.Watch {\n\t\tif !filepath.IsAbs(trigger.Path) {\n\t\t\ttrigger.Path = filepath.Join(baseDir, trigger.Path)\n\t\t}\n\t\tif p, err := filepath.EvalSymlinks(trigger.Path); err == nil {\n\t\t\t// this might fail because the path doesn't exist, etc.\n\t\t\ttrigger.Path = p\n\t\t}\n\t\ttrigger.Path = filepath.Clean(trigger.Path)\n\t\tif trigger.Path == \"\" {\n\t\t\treturn nil, errors.New(\"watch rules MUST define a path\")\n\t\t}\n\n\t\tif trigger.Action == types.WatchActionRebuild && service.Build == nil {\n\t\t\treturn nil, fmt.Errorf(\"service %s doesn't have a build section, can't apply %s on watch\", types.WatchActionRebuild, service.Name)\n\t\t}","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/watch.go#L390-L426","documentation":"When normalizing legacy x-develop watch paths, compose resolves the project working directory through filepath.EvalSymlinks to make relative trigger paths absolute. If that call fails (directory deleted, permission denied along the path), this wrapped error is returned.","triggerScenarios":"Using a service with a legacy x-develop extension while the project's working directory cannot be resolved: it was removed after the project loaded, a parent directory lost execute permission, or the path passes through a broken symlink chain.","commonSituations":"Watching from a temp/checkout directory that another process deletes; macOS /tmp symlink edge cases; restricted environments where the working dir is not traversable; CI workspaces cleaned concurrently.","solutions":["Confirm the project working directory exists and is traversable: ls -ld on each path component of the directory shown in the error.","Restore or recreate the working directory (git checkout / re-clone) if it was deleted, then rerun watch.","Fix or remove broken symlinks in the directory chain (readlink -f <dir>).","Migrate from deprecated x-develop to the official develop attribute, which reduces reliance on this resolution path."],"exampleFix":"# before (deprecated, triggers EvalSymlinks on working dir)\nservices:\n  web:\n    x-develop:\n      watch:\n        - path: ./src\n          action: sync\n\n# after (official attribute)\nservices:\n  web:\n    develop:\n      watch:\n        - path: ./src\n          target: /app/src\n          action: sync","handlingStrategy":"validation","validationCode":"func workingDirResolvable(dir string) bool {\n\t_, err := filepath.EvalSymlinks(dir)\n\treturn err == nil\n}","typeGuard":null,"tryCatchPattern":"if _, err := composeService.Watch(ctx, projectName, opts); err != nil {\n    if strings.Contains(err.Error(), \"resolving symlink for\") {\n        // verify/recreate the working directory, fix symlink chain, retry\n    }\n    return err\n}","preventionTips":["Run watch from a stable, existing project directory (not temp dirs subject to cleanup).","Migrate x-develop extensions to the official develop attribute.","Ensure execute permission on every parent of the working directory."],"tags":["compose","watch","x-develop","symlinks","filesystem"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}