{"record":{"id":"f34df4d3bff0c051","repo":"anomalyco/sst","slug":"default-python-dockerfile-not-found-at-s-w","errorCode":null,"errorMessage":"default Python Dockerfile not found at %s: %w","messagePattern":"default Python Dockerfile not found at (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/runtime/python/build.go","lineNumber":222,"sourceCode":"\n\tcustomDockerfile := filepath.Join(projectRoot, \"Dockerfile\")\n\tif _, err := os.Stat(customDockerfile); err == nil {\n\t\treturn copyFile(customDockerfile, outputDockerfile)\n\t}\n\n\tif projectInfo.PyprojectPath != \"\" {\n\t\thandlerPkgDir := filepath.Dir(projectInfo.PyprojectPath)\n\t\tif handlerPkgDir != projectRoot {\n\t\t\thandlerDockerfile := filepath.Join(handlerPkgDir, \"Dockerfile\")\n\t\t\tif _, err := os.Stat(handlerDockerfile); err == nil {\n\t\t\t\treturn copyFile(handlerDockerfile, outputDockerfile)\n\t\t\t}\n\t\t}\n\t}\n\n\tdefaultDockerfile := filepath.Join(path.ResolvePlatformDir(input.CfgPath), \"dist\", \"dockerfiles\", \"python.Dockerfile\")\n\tif _, err := os.Stat(defaultDockerfile); err != nil {\n\t\treturn fmt.Errorf(\"default Python Dockerfile not found at %s: %w\", defaultDockerfile, err)\n\t}\n\n\treturn copyFile(defaultDockerfile, outputDockerfile)\n}\n\n// adjustHandlerPath adjusts the handler path for the artifact structure.\n// Strips workspace prefixes for containers and flattens src/ layouts.\nfunc adjustHandlerPath(input *runtime.BuildInput, projectInfo *projectInfo) (string, error) {\n\thandler := strings.TrimPrefix(input.Handler, \"./\")\n\n\t// For container builds, strip the workspace prefix since source files\n\t// are copied to the root of the build context.\n\tif input.IsContainer && projectInfo.ProjectRoot != \"\" && projectInfo.PyprojectPath != \"\" {\n\t\tworkspaceDir := filepath.Dir(projectInfo.PyprojectPath)\n\t\tif workspaceDir != projectInfo.ProjectRoot {\n\t\t\trelWorkspacePath, err := filepath.Rel(projectInfo.ProjectRoot, workspaceDir)\n\t\t\tif err == nil && relWorkspacePath != \".\" {\n\t\t\t\tprefix := filepath.ToSlash(relWorkspacePath) + \"/\"","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L204-L240","documentation":"The Python runtime in SST expects a default Dockerfile (python.Dockerfile) shipped inside the platform directory. During `ensureDockerfile`, when the project has no custom Dockerfile, it copies the bundled default into the build context. If `os.Stat` on the bundled file fails (missing or unreadable), this error wraps that stat error.","triggerScenarios":"Running `sst deploy`/`sst build` for a `sst.aws.Function` with runtime `python3.x` when the platform dir was not fully built (e.g. `bun run build:platform` skipped) or was partially copied, so `platform/dist/dockerfiles/python.Dockerfile` does not exist.","commonSituations":"Cloning the repo and running the CLI without building the platform; a stale or truncated npm/pypi install of sst where dist assets were pruned; running the CLI binary from the wrong working directory so `path.ResolvePlatformDir` resolves to a location without dist assets; antivirus or cleanup tooling deleting files under `dist/`.","solutions":["Run `bun run setup` (or `bun run build:platform`) in the sst repo so `platform/dist/dockerfiles/python.Dockerfile` is generated","Reinstall the sst package/CLI so bundled dist assets are restored","Verify the file exists: `ls platform/dist/dockerfiles/python.Dockerfile` and check permissions","If using a custom platform path via config, confirm `path.ResolvePlatformDir(cfgPath)` points at the real platform dir"],"exampleFix":"// before: running `go run ./cmd/sst deploy` from a fresh clone without platform assets\n// after:\nbun run build:platform\ncd examples/my-app && go run ../../cmd/sst deploy","handlingStrategy":"validation","validationCode":"import { existsSync } from \"fs\";\nimport * as path from \"path\";\nconst df = path.resolve(\"platform/dist/dockerfiles/python.Dockerfile\");\nif (!existsSync(df)) throw new Error(`Run 'bun run build:platform' — missing ${df}`);","typeGuard":"const hasDefaultDockerfile = (platformDir: string) =>\n  existsSync(path.join(platformDir, \"dist\", \"dockerfiles\", \"python.Dockerfile\"));","tryCatchPattern":null,"preventionTips":["Always run `bun run setup` / `bun run build:platform` after cloning or updating sst","Reinstall the sst package if dist assets appear missing","Add a CI step asserting platform/dist/dockerfiles/*.Dockerfile exist before deploys","Avoid cleanup tools that prune files under dist/ directories"],"tags":["docker","python","build","missing-file"],"backgroundTag":"missing-build-artifact","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}