infiniflow/ragflow · error · Error
Space name is required
Error message
Space name is required
What it means
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.
Source
Thrown at web/src/pages/skills/hooks.ts:749
}
},
// oxlint-disable-next-line react/exhaustive-deps
[t, fetchSkillsFromFileSystem],
);
// Upload a new skill with proper directory structure (with version support)
const uploadSkill = useCallback(
async (
name: string,
version: string,
files: File[],
spaceName?: string,
spaceId?: string,
embdId?: string,
): Promise<boolean> => {
try {
setLoading(true);
if (!spaceName) throw new Error('Space name is required');
// Use spaceName for file system operations, spaceId for indexing
const normalizedSpaceName = spaceName.trim();
const normalizedSpaceId = spaceId?.trim() || normalizedSpaceName;
// Filter out ignored/junk files first
const filteredFiles = filterUploadFiles(files);
// Validate skill format
const validation = await validateSkillFormatImpl(filteredFiles);
if (!validation.valid) {
const errorKey = `skills.validation.${validation.error}`;
const errorMsg = t(errorKey) || t('skills.validation.invalid');
message.error(errorMsg);
return false;
}
// Get space folder ID (using space name for file system)View on GitHub (pinned to 554fb1133a)
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
Example fix
// before
async (
name: string,
version: string,
files: File[],
spaceName?: string,
spaceId?: string,
) => {
if (!spaceName) throw new Error('Space name is required');
// after
async (
name: string,
version: string,
files: File[],
spaceName: string,
spaceId: string,
embdId?: string,
) => {
if (!spaceName.trim()) {
message.error(t('skills.validation.spaceRequired'));
return false;
} Defensive patterns
Strategy: validation
Validate before calling
const canUpload = (name: string, version: string, files: File[], spaceName?: string) => [name, version, spaceName].every((v) => typeof v === 'string' && v.trim().length > 0) && files.length > 0;
Type guard
const hasSpaceName = (s: string | undefined): s is string => typeof s === 'string' && s.trim().length > 0;
Prevention
- Make spaceName a required parameter so the compiler catches missing arguments
- Disable upload until a space is selected in the UI
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Space ID is required
- Skills space not found
- Failed to create skill folder
- Failed to list skills folder
- Failed to get skill folder ID
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/306caecb69d312af.
Report an issue: GitHub.