{"record":{"id":"306caecb69d312af","repo":"infiniflow/ragflow","slug":"space-name-is-required","errorCode":null,"errorMessage":"Space name is required","messagePattern":"Space name is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/pages/skills/hooks.ts","lineNumber":749,"sourceCode":"      }\n    },\n    // oxlint-disable-next-line react/exhaustive-deps\n    [t, fetchSkillsFromFileSystem],\n  );\n\n  // Upload a new skill with proper directory structure (with version support)\n  const uploadSkill = useCallback(\n    async (\n      name: string,\n      version: string,\n      files: File[],\n      spaceName?: string,\n      spaceId?: string,\n      embdId?: string,\n    ): Promise<boolean> => {\n      try {\n        setLoading(true);\n        if (!spaceName) throw new Error('Space name is required');\n\n        // Use spaceName for file system operations, spaceId for indexing\n        const normalizedSpaceName = spaceName.trim();\n        const normalizedSpaceId = spaceId?.trim() || normalizedSpaceName;\n\n        // Filter out ignored/junk files first\n        const filteredFiles = filterUploadFiles(files);\n\n        // Validate skill format\n        const validation = await validateSkillFormatImpl(filteredFiles);\n        if (!validation.valid) {\n          const errorKey = `skills.validation.${validation.error}`;\n          const errorMsg = t(errorKey) || t('skills.validation.invalid');\n          message.error(errorMsg);\n          return false;\n        }\n\n        // Get space folder ID (using space name for file system)","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/web/src/pages/skills/hooks.ts#L731-L767","documentation":"Thrown in web/src/pages/skills/hooks.ts:749 by uploadSkill when the optional spaceName argument is falsy. Skills must be uploaded under a named file-manager space folder, so a missing name is a caller-side programming error, not a backend failure. It aborts before any network call is made.","triggerScenarios":"Invoking uploadSkill(name, version, files) without the 4th argument; passing an empty string or undefined because the space selector had no selection; race where the spaces list was still loading and the selected value defaulted to undefined.","commonSituations":"UI lets the user click Upload before choosing a skill space. Refactor of uploadSkill signature reordered parameters and callers were not all updated. Space dropdown value is '' as its initial state.","solutions":["Make spaceName a required parameter of uploadSkill so TypeScript rejects the call at compile time","Disable the upload button until a space is selected in the UI","Default the selection to the first available space when only one space exists","Show a form validation message instead of throwing when space is missing"],"exampleFix":"// before\nasync (\n  name: string,\n  version: string,\n  files: File[],\n  spaceName?: string,\n  spaceId?: string,\n) => {\n  if (!spaceName) throw new Error('Space name is required');\n\n// after\nasync (\n  name: string,\n  version: string,\n  files: File[],\n  spaceName: string,\n  spaceId: string,\n  embdId?: string,\n) => {\n  if (!spaceName.trim()) {\n    message.error(t('skills.validation.spaceRequired'));\n    return false;\n  }","handlingStrategy":"validation","validationCode":"const canUpload = (name: string, version: string, files: File[], spaceName?: string) =>\n  [name, version, spaceName].every((v) => typeof v === 'string' && v.trim().length > 0) && files.length > 0;","typeGuard":"const hasSpaceName = (s: string | undefined): s is string =>\n  typeof s === 'string' && s.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Make spaceName a required parameter so the compiler catches missing arguments","Disable upload until a space is selected in the UI"],"tags":["validation","skills","typescript","upload"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}