{"record":{"id":"caf3d60e65979b3e","repo":"anomalyco/sst","slug":"failed-to-copy-workspace-packages-for-container","errorCode":null,"errorMessage":"failed to copy workspace packages for container: %w","messagePattern":"failed to copy workspace packages for container: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":645,"sourceCode":"// parseInputProperties parses the input properties JSON\nfunc parseInputProperties(input *runtime.BuildInput) (*inputProperties, error) {\n\tvar props inputProperties\n\tif err := json.Unmarshal(input.Properties, &props); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse properties: %w\", err)\n\t}\n\n\treturn &props, nil\n}\n\nfunc installDependenciesForLambda(ctx context.Context, input *runtime.BuildInput, projectInfo *projectInfo, architecture string) error {\n\tif err := copySourceFilesSimple(input, projectInfo); err != nil {\n\t\treturn fmt.Errorf(\"failed to copy source files: %w\", err)\n\t}\n\n\t// Container builds: Dockerfile handles deps; zip builds: install here\n\tif input.IsContainer {\n\t\tif err := copyWorkspacePackagesForContainer(input, projectInfo); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy workspace packages for container: %w\", err)\n\t\t}\n\t} else {\n\t\tif err := copySyncedDependencies(ctx, input, projectInfo, architecture); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy synced dependencies: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// copyWorkspacePackagesForContainer copies workspace package directories into the artifact\n// so the Dockerfile's `uv pip install -r requirements.txt` can resolve relative paths.\nfunc copyWorkspacePackagesForContainer(input *runtime.BuildInput, projectInfo *projectInfo) error {\n\tworkspaceRoot := findWorkspaceRoot(projectInfo)\n\n\trequirementsPath := filepath.Join(input.Out(), \"requirements.txt\")\n\tcontent, err := os.ReadFile(requirementsPath)\n\tif err != nil {","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L627-L663","documentation":"For container builds, installDependenciesForLambda copies workspace-local Python packages (sibling packages in the monorepo/workspace) next to the function so the Dockerfile can install them. This error means one of those package copies failed, before Docker ever runs.","triggerScenarios":"copyWorkspacePackagesForContainer fails while reading or copying a workspace package's files: the package path listed in the workspace config doesn't exist, its files are unreadable, or the destination in the build output can't be written.","commonSituations":"Monorepo where a package referenced as a workspace dependency was moved/renamed or deleted; a workspace package with restrictive file permissions; stale cached workspace listing pointing at an old path after a refactor.","solutions":["Confirm every workspace package path in your project config exists on disk (ls each path from the error message)","Update the function's dependency references after any package rename/move","Fix permissions on the workspace package directory (chmod -R u+rX)","Clear stale build state (.sst) and rebuild so the workspace list is recomputed"],"exampleFix":"// before (sst.config.ts — package renamed but dependency path stale)\n\"dependencies\": [\"../packages/shared\"]  // packages/shared no longer exists\n// after\nls packages/\n\"dependencies\": [\"../packages/shared-py\"]","handlingStrategy":"validation","validationCode":"for _, dep := range workspaceDeps { // e.g. \"../packages/shared\"\n\tfull := filepath.Join(projectRoot, dep)\n\tif fi, err := os.Stat(full); err != nil || !fi.IsDir() {\n\t\tlog.Fatalf(\"workspace package %s missing — update config after renames\", full)\n\t}\n\tif unix.Access(full, unix.R_OK) != nil {\n\t\tlog.Fatalf(\"workspace package %s not readable\", full)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := deploy(); err != nil && strings.Contains(err.Error(), \"failed to copy workspace packages for container\") {\n\tfmt.Println(\"verify each workspace package path exists and is readable; rm -rf .sst to clear stale workspace lists\")\n\tos.Exit(1)\n}","preventionTips":["After moving/renaming workspace packages, update every reference in sst.config.ts","Avoid concurrent builds sharing the same .sst output","Keep workspace package dirs readable (chmod -R u+rX packages/)","Rebuild from a clean .sst after refactors"],"tags":["filesystem","python","container","docker","workspace"],"backgroundTag":"file-copy-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}