Crosstalk-Solutions/project-nomad · warning

name is required.

Error message

name is required.

What it means

400 validation error: the delete-collection endpoint requires a non-empty name that passes sanitizeCollectionName.

Source

Thrown at admin/app/controllers/rag_controller.ts:116

    const oldName = sanitizeCollectionName(request.input('oldName', null))
    const newName = sanitizeCollectionName(request.input('newName', null))

    if (!oldName || !newName) {
      return response.status(400).json({ error: 'oldName and newName are required.' })
    }

    const result = await this.ragService.renameKnowledgeCollection(oldName, newName)
    if (!result.success) {
      return response.status(500).json({ error: result.message })
    }
    return response.status(200).json({ message: result.message })
  }

  public async deleteKnowledgeCollection({ request, response }: HttpContext) {
    const name = sanitizeCollectionName(request.input('name', null))

    if (!name) {
      return response.status(400).json({ error: 'name is required.' })
    }

    const result = await this.ragService.deleteKnowledgeCollection(name)
    if (!result.success) {
      return response.status(500).json({ error: result.message })
    }
    return response.status(200).json({ message: result.message })
  }

  public async getFileWarnings({ response }: HttpContext) {
    const result = await this.ragService.computeFileWarnings()
    return response.status(200).json(result)
  }

  public async deleteFile({ request, response }: HttpContext) {
    const { source } = await request.validateUsing(deleteFileSchema)
    const result = await this.ragService.deleteFileBySource(source)
    if (!result.success) {

View on GitHub (pinned to 0bd1c6f4f9)

Solutions

  1. Include a non-empty name in the request body.
  2. Confirm exact field name is 'name'.
  3. Guard the delete action in the UI until a collection is selected.

Example fix

// before
body: JSON.stringify({})
// after
body: JSON.stringify({ name: 'my-collection' })
Defensive patterns

Strategy: validation

Validate before calling

if (!name || !name.trim()) throw new BadRequest('name is required')

Type guard

const hasName = (b: unknown): b is { name: string } => typeof (b as any)?.name === 'string' && (b as any).name.trim() !== ''

Prevention

When it happens

Trigger: POST/DELETE to delete knowledge collection without name, with empty/whitespace string, or a name that sanitizes to null.

Common situations: Delete button invoked with an unset selected row; whitespace or special-character collection name; missing JSON body.

Related errors


AI-assisted analysis of Crosstalk-Solutions/project-nomad@0bd1c6f4f9 (2026-08-27). Data as JSON: /api/errors/102c67c2a05750a7. Report an issue: GitHub.