{"record":{"id":"6d66ff221e09a267","repo":"wavetermdev/waveterm","slug":"error-making-blockfile-q-w","errorCode":null,"errorMessage":"error making blockfile %q: %w","messagePattern":"error making blockfile %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/block.go","lineNumber":95,"sourceCode":"\t}()\n\tif blockDef == nil {\n\t\treturn nil, fmt.Errorf(\"blockDef is nil\")\n\t}\n\tif blockDef.Meta == nil || blockDef.Meta.GetString(waveobj.MetaKey_View, \"\") == \"\" {\n\t\treturn nil, fmt.Errorf(\"no view provided for new block\")\n\t}\n\tblockData, err := createBlockObj(ctx, tabId, blockDef, rtOpts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating block: %w\", err)\n\t}\n\tblockCreated = true\n\tnewBlockOID = blockData.OID\n\t// upload the files if present\n\tif len(blockDef.Files) > 0 {\n\t\tfor fileName, fileDef := range blockDef.Files {\n\t\t\terr := filestore.WFS.MakeFile(ctx, newBlockOID, fileName, fileDef.Meta, wshrpc.FileOpts{})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error making blockfile %q: %w\", fileName, err)\n\t\t\t}\n\t\t\terr = filestore.WFS.WriteFile(ctx, newBlockOID, fileName, []byte(fileDef.Content))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error writing blockfile %q: %w\", fileName, err)\n\t\t\t}\n\t\t}\n\t}\n\tif recordTelemetry {\n\t\tblockView := blockDef.Meta.GetString(waveobj.MetaKey_View, \"\")\n\t\tblockController := blockDef.Meta.GetString(waveobj.MetaKey_Controller, \"\")\n\t\tgo recordBlockCreationTelemetry(blockView, blockController, false)\n\t}\n\treturn blockData, nil\n}\n\nfunc recordBlockCreationTelemetry(blockView string, blockController string, subBlock bool) {\n\tdefer func() {\n\t\tpanichandler.PanicHandler(\"CreateBlock:telemetry\", recover())","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/block.go#L77-L113","documentation":"After the block object is created, CreateBlockWithTelemetry creates any files declared in blockDef.Files via filestore.WFS.MakeFile. If the virtual filesystem refuses to create the named file (invalid name, opts, or zone failure), block creation is rolled back and this error wraps the cause.","triggerScenarios":"BlockDef.Files contains an entry whose MakeFile call fails: illegal filename, invalid file meta, or an underlying WFS/storage error for the new block's zone.","commonSituations":"Block definitions with path-like or reserved filenames; unsupported meta for the file type; storage backend unavailable (disk full, permission issues).","solutions":["Inspect the wrapped inner error from WFS.MakeFile","Use simple, legal file names (no path separators or reserved characters) in blockDef.Files","Verify disk space and filestore zone health, then retry block creation"],"exampleFix":"// before\nFiles: map[string]*waveobj.BlockFile{\"a/b.txt\": {Content: \"x\"}}\n// after\nFiles: map[string]*waveobj.BlockFile{\"a-b.txt\": {Content: \"x\"}}","handlingStrategy":"try-catch","validationCode":"for name := range blockDef.Files {\n    if strings.ContainsAny(name, \"/\\\\\") {\n        return fmt.Errorf(\"illegal blockfile name: %q\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":"block, err := wcore.CreateBlock(ctx, tabId, blockDef, rtOpts)\nif err != nil && strings.Contains(err.Error(), \"error making blockfile\") {\n    // fix filename/meta or storage, then retry\n}","preventionTips":["Use flat, legal file names in blockDef.Files","Keep file meta compatible with wshrpc.FileOpts","Ensure adequate disk space for the filestore"],"tags":["filestore","blocks","filesystem"],"backgroundTag":"file-creation-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}