{"record":{"id":"c11fa94f51eeb9b8","repo":"bettercap/bettercap","slug":"error-creating-s-v","errorCode":null,"errorMessage":"error creating %s: %v","messagePattern":"error creating (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/graph/node.go","lineNumber":81,"sourceCode":"\tif raw, err := ioutil.ReadFile(fileName); err != nil {\n\t\treturn nil, fmt.Errorf(\"error while reading %s: %v\", fileName, err)\n\t} else if err = json.Unmarshal(raw, &node); err != nil {\n\t\treturn nil, fmt.Errorf(\"error while decoding %s: %v\", fileName, err)\n\t}\n\treturn &node, nil\n}\n\nfunc WriteNode(fileName string, node *Node, update bool) error {\n\tif update {\n\t\tnode.UpdatedAt = time.Now()\n\t} else {\n\t\tnode.CreatedAt = time.Now()\n\t}\n\n\tif raw, err := json.Marshal(node); err != nil {\n\t\treturn fmt.Errorf(\"error creating data for %s: %v\", fileName, err)\n\t} else if err = ioutil.WriteFile(fileName, raw, os.ModePerm); err != nil {\n\t\treturn fmt.Errorf(\"error creating %s: %v\", fileName, err)\n\t}\n\treturn nil\n}\n\nfunc CreateNode(fileName string, node *Node) error {\n\treturn WriteNode(fileName, node, false)\n}\n\nfunc UpdateNode(fileName string, node *Node) error {\n\treturn WriteNode(fileName, node, true)\n}\n\nfunc (n Node) String() string {\n\tif n.Dummy == false {\n\t\treturn fmt.Sprintf(\"%s_%s\", n.Type, n.ID)\n\t}\n\treturn string(n.Type)\n}","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/bettercap/bettercap/blob/8eca2820f3c41d2004434ed5a291d87462caeeb7/modules/graph/node.go#L63-L99","documentation":"I/O error wrapping in graph.WriteNode: marshaling succeeded but ioutil.WriteFile failed persisting the node file (permission denied, disk full, missing directory). Raised from CreateNode/UpdateNode, so the change is lost even though the in-memory graph was updated.","triggerScenarios":"Thrown at modules/graph/node.go:81 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions and free space on the directory holding the graph files","Ensure the parent directory exists before writing","Retry the write on transient failures"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8eca2820f3c41d2004434ed5a291d87462caeeb7","analyzedAt":"2026-09-02T12:49:00.712Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}