siyuan-note/siyuan · error

writing file paths to clipboard is not supported on this…

Error message

writing file paths to clipboard is not supported on this platform

What it means

This is the platform-stub build of util.WriteFilePaths (used on platforms other than Windows and macOS, e.g. Linux builds of the kernel). It always returns this error because writing file paths to the system clipboard is only implemented for Windows and macOS.

Solutions

  1. Guard the feature with a platform check and hide the copy-files menu entry on unsupported platforms
  2. Implement a clipboard_linux.go variant (e.g. via xclip/xdg or Freedesktop file-list targets) if support is needed
  3. On Linux, copy paths as text via the existing text-clipboard API instead

Example fix

// before
util.WriteFilePaths(paths) // panics into error on Linux
// after
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
    util.WriteFilePaths(paths)
} else {
    util.WriteClipboard(fmt.Sprintf("file://%s", strings.Join(paths, "\n")))
}
Defensive patterns

Strategy: fallback

Validate before calling

if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
    // use text-clipboard fallback or hide the feature
}

Type guard

func canWriteFilePaths() bool { return runtime.GOOS == "windows" || runtime.GOOS == "darwin" }

Try / catch

if err := util.WriteFilePaths(paths); err != nil {
    // fall back to copying paths as plain text
    _ = util.WriteClipboard(strings.Join(paths, "\n"))
}

Prevention

When it happens

Trigger: Any call to util.WriteFilePaths on a non-Windows/non-macOS build of the kernel — e.g. a Linux desktop or server build invoking the 'copy file to clipboard' feature.

Common situations: Using the SiYuan 'copy asset/file' clipboard action on Linux where the kernel stub returns unsupported; embedding the kernel on an unsupported OS.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/7ca3b6dc28586ebf. Report an issue: GitHub.

Appendix: 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 9f775e8a12)