Skip to content

Auto-filled Duties exceeds translator 2,000-char limit, causing a silent 400 #1262

Description

@jinu2ID

Summary

On the Military-to-Civilian Translator, selecting an MOS auto-fills the Key Duties & Responsibilities box with the full official job-code description. For many codes that text is far longer than the translate endpoint allows, so submitting returns a 400 that the UI never surfaces. The user sees the blue "instant dictionary" banner keep spinning and assumes the AI is hanging.

Steps to reproduce

  1. Go to /resume-translator.
  2. Enter job code 11B, branch Army, rank Sergeant, years of service 7.
  3. Leave the auto-filled Duties as-is.
  4. Submit.

Result: the AI result never appears; the blue banner spins indefinitely.

Root cause

  • The MOS auto-fill populates Duties with the full description. For 11B that is 9,239 characters.
  • src/pages/api/military-resume/translate.ts caps duties at 2,000 characters (MAX_FIELD) and returns:
    400 {"error":"Duties and achievements must be under 2,000 characters each."}
  • src/hooks/use-translator.ts treats any non-200 as "AI unavailable" and keeps the dictionary result without showing the error, so the spinning banner stays up and reads as a hang.

Impact

Any user who relies on the Duties auto-fill (the default path) and does not manually trim it gets a failed translation with no explanation.

Suggested fixes (pick one or combine)

  1. Truncate the auto-filled Duties to a sensible length when populating the form.
  2. Raise or remove the 2,000-char server limit for Duties.
  3. Surface the 400 validation message in the UI instead of leaving the spinner up.

Related files

  • src/pages/api/military-resume/translate.ts (validation limit)
  • src/hooks/use-translator.ts (swallows the error)
  • src/components/translator/TranslatorForm.tsx (Duties auto-fill)

Discovered while verifying #1011.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions