{"record":{"id":"2ba3c7e103794162","repo":"wavetermdev/waveterm","slug":"failed-to-create-wavefs-file-w","errorCode":null,"errorMessage":"failed to create WaveFS file: %w","messagePattern":"failed to create WaveFS file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/jobcontroller/jobcontroller.go","lineNumber":689,"sourceCode":"\t\terr = AttachJobToBlock(ctx, jobId, params.BlockId)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to attach job to block: %w\", err)\n\t\t}\n\t}\n\tbareRpc := wshclient.GetBareRpcClient()\n\tbroker := bareRpc.StreamBroker\n\treaderRouteId := wshclient.GetBareRpcClientRouteId()\n\twriterRouteId := wshutil.MakeJobRouteId(jobId)\n\treader, streamMeta := broker.CreateStreamReader(readerRouteId, writerRouteId, DefaultStreamRwnd)\n\tjobStreamIds.Set(jobId, streamMeta.Id)\n\n\tfileOpts := wshrpc.FileOpts{\n\t\tMaxSize:  10 * 1024 * 1024,\n\t\tCircular: true,\n\t}\n\terr = filestore.WFS.MakeFile(ctx, jobId, JobOutputFileName, wshrpc.FileMeta{}, fileOpts)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create WaveFS file: %w\", err)\n\t}\n\n\tclientId := wstore.GetClientId()\n\tpublicKey := wavejwt.GetPublicKey()\n\tpublicKeyBase64 := base64.StdEncoding.EncodeToString(publicKey)\n\tjobEnv := envutil.CopyAndAddToEnvMap(params.Env, \"WAVETERM_JOBID\", jobId)\n\tstartJobData := wshrpc.CommandRemoteStartJobData{\n\t\tCmd:                params.Cmd,\n\t\tArgs:               params.Args,\n\t\tEnv:                jobEnv,\n\t\tTermSize:           *params.TermSize,\n\t\tStreamMeta:         streamMeta,\n\t\tJobAuthToken:       jobAuthToken,\n\t\tJobId:              jobId,\n\t\tMainServerJwtToken: jobAccessToken,\n\t\tClientId:           clientId,\n\t\tPublicKeyBase64:    publicKeyBase64,\n\t}","sourceCodeStart":671,"sourceCodeEnd":707,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/jobcontroller/jobcontroller.go#L671-L707","documentation":"StartJob creates the job's circular output capture file (JobOutputFileName, 10MB max) in WaveFS via filestore.WFS.MakeFile; failure is wrapped with this message. The WaveFS file for a job lives under the job's OID in the virtual file store, so this signals virtual-filesystem or underlying storage failure.","triggerScenarios":"MakeFile errors because the job's WaveFS directory/file cannot be created — e.g. a file with the same name already exists with incompatible opts, underlying blockfile/storage I/O error, or the job record insert left partial state.","commonSituations":"Retrying StartJob after a partial failure left a stale output file, disk full, storage backend (local file system) permission problems.","solutions":["Read the wrapped cause (%w): if it is 'file already exists', delete or recreate the job output file and retry with a new job.","Check disk space and write permissions in the Wave data directory.","Retry StartJob — a fresh jobId creates a fresh WaveFS path."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"jobId, err := jobcontroller.StartJob(ctx, params)\nif err != nil && strings.Contains(err.Error(), \"failed to create WaveFS file\") {\n    // retry: a new jobId creates a fresh WaveFS path\n    jobId, err = jobcontroller.StartJob(ctx, params)\n}","preventionTips":["Avoid reusing job ids; always start jobs with freshly generated ids.","Monitor disk space and permissions in the Wave data directory.","Clean up stale job output files after partial startup failures."],"tags":["filesystem","wavefs","storage"],"backgroundTag":"file-create-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}