{"record":{"id":"bf4689be1d03c4d4","repo":"siyuan-note/siyuan","slug":"start-command-w","errorCode":null,"errorMessage":"start command: %w","messagePattern":"start command: %w","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/mcp/client/mcp.go","lineNumber":475,"sourceCode":"\t\t}\n\t\treturn conf.ResolveSecretsVars(model.Conf.Secrets, model.Conf.Variables, value)\n\t}, runtime.GOOS)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"environment: %w\", err)\n\t}\n\tcmd.Env = cmdEnv\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"stdin pipe: %w\", err)\n\t}\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"stdout pipe: %w\", err)\n\t}\n\tcmd.Stderr = io.Discard\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"start command: %w\", err)\n\t}\n\n\tconnectCtx, connectCancel := context.WithTimeout(ctx, serverTimeout(server))\n\tdefer connectCancel()\n\ttransport := &mcp.IOTransport{Reader: stdout, Writer: stdin}\n\tsession, err := client.Connect(connectCtx, transport, nil)\n\tif err != nil {\n\t\tcmd.Process.Kill()\n\t\tcmd.Wait()\n\t\treturn nil, cmd, fmt.Errorf(\"connect: %w\", err)\n\t}\n\n\treturn session, cmd, nil\n}\n\ntype environmentEntry struct {\n\tname  string\n\tvalue string","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/mcp/client/mcp.go#L457-L493","documentation":"Returned when exec.Cmd.Start() cannot launch the configured command for a stdio MCP server. Start resolves the binary on PATH (if not absolute) and execs it; failure means the binary could not be found, is not executable, or the OS refused to create the process. The wrapped error (typically exec.ErrNotFound, EACCES, or ENOENT) is preserved.","triggerScenarios":"connectStdio calls cmd.Start() with server.Command that does not exist on PATH, is not marked executable (Unix), is a directory, or the kernel process lacks permission to fork/exec. Also fired when the command path is absolute but points at a missing file.","commonSituations":"Configuring npx/node/python/uvx without that runtime installed or on PATH for the kernel; running the kernel as a service whose PATH differs from the interactive shell; executable bit not set after extracting a tool; typo in the command path; on macOS, an xcode-select / gatekeeping refusal.","solutions":["Verify the binary exists and is executable from the kernel's own environment: run exec.LookPath(server.Command) (or 'which <cmd>') using the same user/PATH the kernel runs under.","Use an absolute path in server.Command to remove PATH ambiguity.","Ensure the runtime (node, python, npx, uvx, etc.) is installed and on the PATH seen by the kernel process — for a systemd unit, set Environment=PATH=... explicitly.","On Unix, chmod +x the binary; on Windows, include the extension (.exe, .cmd, .bat) if needed."],"exampleFix":"// before\nserver.Command = \"mcp-server\"\nserver.Args = []string{}\n// after\nserver.Command = \"/usr/local/bin/mcp-server\"\nserver.Args = []string{}","handlingStrategy":"validation","validationCode":"// Confirm the command resolves on the kernel's PATH before attempting connect.\nimport \"os/exec\"\nfunc commandResolves(cmd string) error {\n    if cmd == \"\" { return errors.New(\"empty command\") }\n    if _, err := exec.LookPath(cmd); err != nil { return err }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Distinguish 'not found' from 'permission denied' for UI messaging.\nvar pathErr *exec.Error\nif errors.As(err, &pathErr) {\n    // pathErr.Name is the command; surface 'install <runtime>' hint\n}","preventionTips":["Prefer absolute paths in server.Command.","For service deployments, set an explicit PATH in the unit environment.","Run exec.LookPath at config-save time."],"tags":["mcp","stdio","process-launch","config"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}