{"record":{"id":"99e2916b3433de0a","repo":"siyuan-note/siyuan","slug":"attribute-view-definition-is-not-a-regular-file-s","errorCode":null,"errorMessage":"attribute view definition is not a regular file: %s","messagePattern":"attribute view definition is not a regular file: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/asset_relink.go","lineNumber":382,"sourceCode":"\t\t\t}\n\t\t\treason, checked := availability[n.AttributeViewID]\n\t\t\tif !checked {\n\t\t\t\tif !ast.IsNodeIDPattern(n.AttributeViewID) {\n\t\t\t\t\treason = \"invalid_id\"\n\t\t\t\t} else {\n\t\t\t\t\tabs := filepath.Join(dir, n.AttributeViewID+\".json\")\n\t\t\t\t\tif checkErr = p.observe(abs); checkErr != nil {\n\t\t\t\t\t\treturn ast.WalkStop\n\t\t\t\t\t}\n\t\t\t\t\tinfo, statErr := os.Lstat(abs)\n\t\t\t\t\tif os.IsNotExist(statErr) {\n\t\t\t\t\t\t// 数据库定义不参与资源按需下载；缺失定义作为历史残留上报，保留数据库块。\n\t\t\t\t\t\treason = \"missing_definition\"\n\t\t\t\t\t} else if statErr != nil {\n\t\t\t\t\t\tcheckErr = statErr\n\t\t\t\t\t\treturn ast.WalkStop\n\t\t\t\t\t} else if !info.Mode().IsRegular() {\n\t\t\t\t\t\tcheckErr = fmt.Errorf(\"attribute view definition is not a regular file: %s\", abs)\n\t\t\t\t\t\treturn ast.WalkStop\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tavailability[n.AttributeViewID] = reason\n\t\t\t}\n\t\t\tif reason != \"\" {\n\t\t\t\tname, loaded := boxNames[tree.Box]\n\t\t\t\tif !loaded {\n\t\t\t\t\tname = (&Box{ID: tree.Box}).GetConf().Name\n\t\t\t\t\tboxNames[tree.Box] = name\n\t\t\t\t}\n\t\t\t\tp.result.UnavailableAttributeViews = append(p.result.UnavailableAttributeViews, apicontract.UnavailableAssetAttributeView{\n\t\t\t\t\tAvID: n.AttributeViewID, Notebook: tree.Box, NotebookName: name, RootID: tree.Root.ID,\n\t\t\t\t\tBlockID: n.ID, Path: tree.Path, HPath: tree.HPath, Reason: reason,\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn ast.WalkContinue\n\t\t})","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/asset_relink.go#L364-L400","documentation":"When checking whether an attribute view used in a document has a local definition, the scanner lstats storage/av/<id>.json. If the entry exists but is not a regular file (directory, symlink, device), the walk aborts because availability cannot be determined safely.","triggerScenarios":"A document block references an attribute view whose storage/av/<id>.json path exists but is a directory or symlink instead of a regular file; discovered during the ast.Walk availability check in scanViews.","commonSituations":"A directory was accidentally created named like an AV id (e.g. by a script appending '/'); sync or backup tooling replaced the file with a symlink; filesystem corruption.","solutions":["Remove the non-regular entry and restore a real .json definition file at that path","If it is a stray directory, delete it and let the app recreate the definition","Fix the sync/backup tool so it dereferences symlinks and never creates directories at that path"],"exampleFix":"// before\n// data/storage/av/20240101120000-abc123.json is a directory\n// after\nos.RemoveAll(\"data/storage/av/20240101120000-abc123.json\")\n// restore the real file from history/sync","handlingStrategy":"validation","validationCode":"// pre-check every AV definition referenced by documents\ninfo, err := os.Lstat(filepath.Join(dataDir, \"storage\", \"av\", avID+\".json\"))\nif err == nil && !info.Mode().IsRegular() {\n\t// replace the non-regular entry with a real file\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not create directories or symlinks named like AV ids under storage/av","Fix sync tooling that materializes files as symlinks or directories","Audit storage/av for non-regular entries after external restores"],"tags":["attribute-view","filesystem","symlink","storage"],"backgroundTag":"incompatible-source-type","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}