{"record":{"id":"c18844b941661305","repo":"siyuan-note/siyuan","slug":"dir-s-has-more-than-1-file-s","errorCode":null,"errorMessage":"dir [%s] has more than 1 file:\n%s","messagePattern":"dir \\[(.+?)\\] has more than 1 file:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"kernel/util/runtime.go","lineNumber":425,"sourceCode":"\t\t\t}\n\n\t\t\tcheckFilenames := bytes.Buffer{}\n\t\t\tfor _, entry := range entries {\n\t\t\t\tif !entry.IsDir() && strings.Contains(entry.Name(), \"check_\") {\n\t\t\t\t\tcheckFilenames.WriteString(entry.Name())\n\t\t\t\t\tcheckFilenames.WriteString(\"\\n\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tlines := strings.Split(strings.TrimSpace(checkFilenames.String()), \"\\n\")\n\t\t\tif 1 < len(lines) {\n\t\t\t\tbuf := bytes.Buffer{}\n\t\t\t\tfor _, line := range lines {\n\t\t\t\t\tbuf.WriteString(\"  \")\n\t\t\t\t\tbuf.WriteString(line)\n\t\t\t\t\tbuf.WriteString(\"\\n\")\n\t\t\t\t}\n\t\t\t\toutput := buf.String()\n\t\t\t\tReportFileSysFatalError(fmt.Errorf(\"dir [%s] has more than 1 file:\\n%s\", dir, output))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif err = os.RemoveAll(tmp); err != nil {\n\t\t\tReportFileSysFatalError(err)\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc IsCloudDrivePath(workspaceAbsPath string) bool {\n\tif isICloudPath(workspaceAbsPath) {\n\t\treturn true\n\t}\n\n\tif isKnownCloudDrivePath(workspaceAbsPath) {\n\t\treturn true","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/util/runtime.go#L407-L443","documentation":"During the filesystem status check the kernel writes a probe file (.siyuan/filesys_status_check), lets any third-party sync client act on it, then inspects the resulting directory layout. If the probe directory unexpectedly contains more than one file, an external process (typically a sync client) has modified it, so the kernel reports a fatal filesystem error with the directory listing.","triggerScenarios":"A third-party sync client materializes extra files (conflict copies, metadata files) inside the probe temp directory while checkFileSysStatus runs; the dir listing passed to the error shows the offending files.","commonSituations":"OneDrive/Dropbox sync conflicts creating 'file-DESKTOP-XYZ (1).conflict' copies; antivirus quarantine leaving marker files; iCloud 'dataless' file materialization; NAS sync agents writing .tmp sidecar files.","solutions":["Identify the process creating the extra files from the listing in the error message","Exclude the workspace from any third-party sync/antivirus real-time scanning","Pause or uninstall the third-party sync client, then restart the kernel to re-run the check","Move the workspace to a locally-controlled directory"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"onFileSysFatalError((err) => {\n    // back up workspace and relocate it to a non-synced directory\n});","preventionTips":["Exclude the workspace from all third-party sync and antivirus real-time scanners","Investigate any reported directory listing immediately — extra files indicate an active interferer","Keep the workspace on a locally-controlled volume"],"tags":["filesystem","cloud-sync","data-integrity"],"backgroundTag":"invalid-state-transition","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}