siyuan-note/siyuan · warning
writing file paths to clipboard is not supported on this pla
Error message
writing file paths to clipboard is not supported on this platform
What it means
Returned by the WriteFilePaths stub selected when the build constraint (!windows && !darwin) || ios holds. SiYuan only implements file-path clipboard writing for Windows (CF_HDROP) and macOS (NSPasteboard); on Linux desktop, Android, and iOS the function is a compile-time stub that always errors. The error is a deliberate unsupported-platform sentinel, not a runtime fault.
Source
Thrown at kernel/util/clipboard.go:25
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//go:build (!windows && !darwin) || ios
package util
import "errors"
// 当前仅在 Windows、macOS 上实现,其他平台返回错误
func WriteFilePaths(paths []string) error {
return errors.New("writing file paths to clipboard is not supported on this platform")
}
View on GitHub (pinned to 251596fc0d)
Solutions
- Guard the call site with a runtime.GOOS check and skip 'copy as file' (or fall back to writing the path as plain text) on unsupported platforms.
- If the feature is required, run on Windows or macOS where the real implementation is compiled in.
- Add a platform implementation for the missing OS instead of calling the stub.
Example fix
// before
if err := util.WriteFilePaths([]string{absPath}); err != nil {
return err
}
// after
if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
// fall back to plain-text path on the clipboard
return writeTextClipboard(absPath)
}
if err := util.WriteFilePaths([]string{absPath}); err != nil {
return err
} Defensive patterns
Strategy: validation
Validate before calling
func isWriteFilePathsSupported() bool {
switch runtime.GOOS {
case "windows", "darwin":
return runtime.GOOS != "darwin" || !isIOSSBuild // ios build sets darwin+ios tag
}
return false
} Prevention
- Gate 'copy asset as file' UI on the supported platforms so the stub is never reached.
- Provide a plain-text path fallback so the user still gets the path on Linux/mobile.
When it happens
Trigger: Calling util.WriteFilePaths (directly, or via the kernel API that copies an asset as a file, kernel/api/clipboard.go:90) in a build whose GOOS is neither windows nor darwin, or in an iOS (mobile) build.
Common situations: Running the Electron/desktop kernel on Linux and using the asset 'copy as file' menu; running the kernel in a Docker/headless Linux container; invoking the same clipboard API path from an Android or iOS gomobile build.
Related errors
- update package is unavailable for the current platform
- The sidebar feature that comes with the plugin needs to be c
- invalid rich clipboard asset count [%d]
- invalid rich clipboard asset index [%d]
- unsupported rich clipboard image extension [%s]
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/7ca3b6dc28586ebf.
Report an issue: GitHub.