NousResearch/hermes-agent · warning · Error

Name required

Error message

Name required

What it means

buildMcpServerCreate validates the MCP-server creation draft before sending it to the API. The server name is required and is trimmed before the check; an empty (or whitespace-only) name throws immediately. This is client-side form validation, so it fires before any network call.

Source

Thrown at web/src/lib/mcp-server-create.ts:52

}

function parseEnv(raw: string): Record<string, string> {
  const env: Record<string, string> = {};
  for (const rawLine of raw.split("\n")) {
    const line = rawLine.trim();
    if (!line) continue;
    const separator = line.indexOf("=");
    if (separator === -1) continue;
    const key = line.slice(0, separator).trim();
    const value = line.slice(separator + 1).trim();
    if (key) env[key] = value;
  }
  return env;
}

export function buildMcpServerCreate(draft: McpServerDraft): McpServerCreate {
  const name = draft.name.trim();
  if (!name) throw new Error("Name required");

  if (draft.transport === "http") {
    const url = draft.url.trim();
    if (!url) throw new Error("URL required");
    if (draft.httpAuth === "header" && !draft.bearerToken.trim()) {
      throw new Error("Bearer token required");
    }

    const server: McpServerCreate = { name, url };
    if (draft.httpAuth !== "none") server.auth = draft.httpAuth;
    if (draft.httpAuth === "header") {
      server.bearer_token = draft.bearerToken;
    }
    return server;
  }

  const command = draft.command.trim();
  if (!command) throw new Error("Command required");

View on GitHub (pinned to c896c09c42)

Solutions

  1. Fill in a non-empty name (it becomes the server's registry key) and submit again.
  2. Disable the submit button until draft.name.trim() is non-empty.
  3. In scripts, assert the draft has a trimmed name before calling buildMcpServerCreate.

Example fix

// before
buildMcpServerCreate({ ...draft, name: '   ' })

// after
buildMcpServerCreate({ ...draft, name: 'github'.trim() })
Defensive patterns

Strategy: validation

Validate before calling

const draftValid = (d: McpServerDraft) => d.name.trim().length > 0
if (!draftValid(draft)) {
  setFieldError('name', 'Name is required')
  return
}

Type guard

function hasMcpName(d: McpServerDraft): boolean {
  return d.name.trim().length > 0
}

Try / catch

try {
  const payload = buildMcpServerCreate(draft)
} catch (err) {
  if (String(err) === 'Name required') { focusField('name'); return }
  throw err
}

Prevention

When it happens

Trigger: Submitting the 'add MCP server' form with an empty name field; passing a draft object constructed with name: '' or name: ' '; test fixtures omitting the name.

Common situations: UI allows submit before required fields are filled; programmatic creation scripts that copy a template draft and forget to set the name.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/1a2d264c1e68e819. Report an issue: GitHub.