hcengineering/platform · error

Invalid space configuration in ${spaceName}: ${message}

Error message

Invalid space configuration in ${spaceName}: ${message}

What it means

This is the wrapping error produced by the catch block around per-space processing in processImportFolder. Any failure while parsing or processing a space's YAML config (including the 'Unknown space class' throw) is re-thrown with `Invalid space configuration in <spaceName>: <original message>` so the failing space is identified. The nested message after the colon is the root cause.

Source

Thrown at packages/importer/src/huly/huly.ts:406

              await this.processControlledDocumentsRecursively(builder, spacePath, spacePath)
            }
            break
          }

          case core.class.Enum:
          case core.class.Association:
          case card.class.MasterTag: {
            this.logger.log(`Skipping ${spaceName}: will be processed later`)
            break
          }

          default: {
            throw new Error(`Unknown space class ${spaceConfig.class} in ${spaceName}`)
          }
        }
      } catch (error) {
        const message = error instanceof Error ? error.message : String(error)
        throw new Error(`Invalid space configuration in ${spaceName}: ${message}`)
      }
    }

    const { docs, mixins, updates, files } = await this.cardsProcessor.processDirectory(folderPath)

    const ws = builder.build()
    ws.unifiedDocs = {
      docs: Array.from(docs.values()).flat(),
      mixins: Array.from(mixins.values()).flat(),
      updates: Array.from(updates.values()).flat(),
      files: Array.from(files.values())
    }
    return ws
  }

  private async processIssuesRecursively (
    builder: ImportWorkspaceBuilder,
    projectIdentifier: string,

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Read the nested message after the colon to identify the root cause
  2. Fix the underlying problem in <spaceName>.yaml (unknown class, bad YAML, missing fields)
  3. Validate the YAML syntax with a YAML linter/parser before re-running the import
  4. Compare the file against a working Huly export's space YAML for the correct schema

Example fix

// message you see
Invalid space configuration in MyProject: Unknown space class tracker.class.Projet in MyProject
// fix the root cause in MyProject.yaml
class: tracker.class.Project
Defensive patterns

Strategy: try-catch

Validate before calling

for (const f of spaceYamlFiles(folder)) {
  try { yaml.load(fs.readFileSync(f, 'utf8')) } catch (e) { throw new Error(`${f} is not valid YAML: ${e}`) }
}

Try / catch

try {
  await importer.workspaceData(folder)
} catch (e) {
  const m = e instanceof Error ? e.message : String(e)
  const match = m.match(/Invalid space configuration in (.+?): (.+)/)
  if (match) console.error(`Space "${match[1]}" failed: ${match[2]}`)
  else throw e
}

Prevention

When it happens

Trigger: workspaceData triggers processImportFolder on a folder where reading/parsing a top-level .yaml space file fails — malformed YAML, a schema mismatch when cast to HulySpaceSettings, or an unknown space class thrown inside the try block.

Common situations: A space YAML edited by hand with broken indentation or tabs; a missing required field in the space config; an unsupported class value; YAML that parses but does not match the expected HulySpaceSettings shape.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/9971d0e4c0756181. Report an issue: GitHub.