CherryHQ/cherry-studio · error · Error
Either baseUrl or command must be provided
Error message
Either baseUrl or command must be provided
What it means
Thrown as the final fallback in transport creation when a server has neither a `baseUrl` nor a `command` field. The transport logic checks in-memory servers first, then baseUrl-based (SSE/streamableHttp), then command-based (stdio). If none match, the server configuration is fundamentally incomplete.
Source
Thrown at src/main/ai/mcp/McpRuntimeService.ts:725
})
})
stdioTransport.stderr?.on('end', () => {
const remaining = stderrDecoder.decode()
if (remaining.trim()) {
getServerLogger(server).debug(`Stdio stderr (end)`, { data: remaining })
this.emitServerLog(server, {
timestamp: Date.now(),
level: 'stderr',
message: remaining.trim(),
source: 'stdio'
})
}
})
// StdioClientTransport does not expose stdout as a readable stream for raw logging
// (stdout is reserved for JSON-RPC). Avoid attaching a listener that would never fire.
return stdioTransport
} else {
throw new Error('Either baseUrl or command must be provided')
}
}
const handleAuth = async (
client: Client,
transport: SSEClientTransport | StreamableHTTPClientTransport,
typeOverride?: McpServerType
) => {
getServerLogger(server).debug(`Starting OAuth flow`)
// Create an event emitter for the OAuth callback
const events = new EventEmitter()
// Create a callback server
const callbackServer = new CallBackServer({
port: authProvider.config.callbackPort,
path: authProvider.config.callbackPath || '/oauth/callback',
events
})View on GitHub (pinned to 726446b54c)
Solutions
- Edit the server configuration in MCP settings to provide either a baseUrl (for SSE/streamableHttp) or a command (for stdio)
- If the server entry is corrupted, delete it and recreate with valid configuration
- Add validation in the server creation/import path to require at least one of baseUrl or command
- Check the database record for the server to see what fields are actually populated
Example fix
// before
const server = {
name: 'my-server',
// no baseUrl, no command
}
// after
const server = {
name: 'my-server',
command: 'npx',
args: ['-y', '@my/mcp-server'],
type: 'stdio'
} Defensive patterns
Strategy: validation
Validate before calling
function validateServerConfig(server: Partial<McpServer>): void {
if (!server.baseUrl && !server.command) {
throw new Error('Server must have either a baseUrl (for SSE/streamableHttp) or a command (for stdio)')
}
} Type guard
function hasTransportConfig(server: McpServer): boolean {
return Boolean(server.baseUrl) || Boolean(server.command)
} Try / catch
try {
await runtime.getOrCreateClient(server)
} catch (e) {
if (e instanceof Error && e.message === 'Either baseUrl or command must be provided') {
// Server config is incomplete — prompt user to complete setup
showServerConfigDialog(server)
return
}
throw e
} Prevention
- Require at least one of baseUrl or command in the server creation form
- Validate server configs on import and reject entries missing both fields
- Run a data integrity check on the servers table to find incomplete records
When it happens
Trigger: A server entity in the database has both `baseUrl` and `command` as undefined/empty. This can happen with a corrupted entry, an incomplete import, or a server created with neither field populated.
Common situations: Server was partially configured and saved; a migration created incomplete records; the UI allowed saving without requiring at least one of baseUrl or command; programmatic server creation omitted both fields.
Related errors
- Invalid server type
- Invalid command: command must be a non-empty string
- Invalid command: command cannot be empty
- Invalid args: must be an array
- Invalid args: argument at index ${index} must be a string
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/8169ca95354fb3dd.
Report an issue: GitHub.