{"record":{"id":"cf0845ef7ec17965","repo":"anomalyco/sst","slug":"failed-to-sync-artifacts-v","errorCode":null,"errorMessage":"failed to sync artifacts: %v","messagePattern":"failed to sync artifacts: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/python.go","lineNumber":140,"sourceCode":"\nfunc (r *PythonRuntime) Match(runtime string) bool {\n\treturn strings.HasPrefix(runtime, \"python\")\n}\n\n// ShouldRunEagerly returns false to enable lazy worker startup.\n// Python lacks static import analysis, so any file change triggers ShouldRebuild()\n// for ALL functions. Lazy startup avoids a startup storm of 50+ processes.\nfunc (r *PythonRuntime) ShouldRunEagerly() bool {\n\treturn false\n}\n\nfunc (r *PythonRuntime) Run(ctx context.Context, input *runtime.RunInput) (runtime.Worker, error) {\n\tisLegacyLayout, err := r.syncArtifactsIfNeeded(input)\n\tif err != nil {\n\t\tslog.Error(\"failed to sync artifacts\",\n\t\t\t\"functionID\", input.FunctionID,\n\t\t\t\"error\", err)\n\t\treturn nil, fmt.Errorf(\"failed to sync artifacts: %v\", err)\n\t}\n\n\t// Copy lambda bridge to artifact directory if missing or outdated\n\tlambdaBridgePath := filepath.Join(input.Build.Out, \"lambdaric_python_bridge.py\")\n\tsourceBridgePath := filepath.Join(path.ResolvePlatformDir(input.CfgPath), \"/dist/python-runtime/index.py\")\n\n\tdstInfo, dstErr := os.Stat(lambdaBridgePath)\n\tsrcInfo, srcErr := os.Stat(sourceBridgePath)\n\tif dstErr != nil || (srcErr == nil && srcInfo.ModTime().After(dstInfo.ModTime())) {\n\t\tif err := copyFile(sourceBridgePath, lambdaBridgePath); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to copy lambda bridge: %v\", err)\n\t\t}\n\t}\n\n\tprojectRoot := path.ResolveRootDir(input.CfgPath)\n\n\tvar handlerPath string\n\tvar workingDir string","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/python.go#L122-L158","documentation":"PythonRuntime.Run first calls syncArtifactsIfNeeded to materialize the built artifact directory for the function; on failure it logs the functionID and underlying error, then returns \"failed to sync artifacts: %v\". This means the worker cannot start because the build output could not be synced/copied into place.","triggerScenarios":"syncArtifactsIfNeeded failed — typically the build output directory (input.Build.Out) is missing/empty (build didn't run or was cleaned), a disk/permission error prevented copying, or the legacy-layout detection hit an unreadable path.","commonSituations":"Running dev/deploy after manually deleting .sst or the build output; CI caching that restores an incomplete artifact dir; disk full; read-only volume mounts in containers; concurrent deploys clobbering the same out directory.","solutions":["Re-run the build (sst deploy / restart sst dev) so artifacts are regenerated, then retry.","Inspect the logged 'error' field for the sync root cause (permissions, ENOSPC, missing dir).","Free disk space or fix volume permissions if the OS error indicates ENOSPC/EACCES.","Ensure the build output directory (.sst/... or Build.Out) exists and is writable before starting the runtime."],"exampleFix":"// before\n$ rm -rf .sst && sst dev  // stale state\n\n// after\n$ sst deploy   // rebuild artifacts first\n$ sst dev","handlingStrategy":"try-catch","validationCode":"// shell, before dev/deploy\ntest -d .sst && test -w .sst && df -h . | awk 'NR==2{exit ($4+0>1)?0:1}' || echo 'artifact dir missing/unwritable or disk full'","typeGuard":null,"tryCatchPattern":"try { await deploy() } catch (e) {\n  if (String(e).includes(\"failed to sync artifacts\")) {\n    // inspect logged root cause for functionID, then rebuild\n    await rebuild();\n  }\n  throw e;\n}","preventionTips":["Don't manually delete .sst/build outputs while dev is running.","Ensure CI cache restores complete artifact directories.","Monitor disk space and volume permissions before long dev sessions."],"tags":["python","artifacts","runtime","filesystem"],"backgroundTag":"artifact-sync-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}