{"record":{"id":"c784e4430e576a07","repo":"FuelLabs/fuels-ts","slug":"workspace-not-detected","errorCode":"WORKSPACE_NOT_DETECTED","errorMessage":"Forc workspace not detected in:\n  ${workspace}/Forc.toml\n\nTry using '${swayProgramType}s' instead of 'workspace' in:\n  ${configPath}","messagePattern":"Forc workspace not detected in:\n  (.+?)/Forc\\.toml\n\nTry using '(.+?)s' instead of 'workspace' in:\n  (.+?)","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/fuels/src/cli/config/loadConfig.ts","lineNumber":100,"sourceCode":"\n  if (!userConfig.workspace) {\n    // Resolve members individually\n    const { contracts, predicates, scripts } = userConfig;\n    config.contracts = (contracts || []).map((c: string) => resolve(cwd, c));\n    config.scripts = (scripts || []).map((s: string) => resolve(cwd, s));\n    config.predicates = (predicates || []).map((p: string) => resolve(cwd, p));\n  } else {\n    // Resolve members via workspace\n    const workspace = resolve(cwd, userConfig.workspace);\n    const forcToml = readForcToml(workspace);\n\n    if (!forcToml.workspace) {\n      const workspaceMsg = `Forc workspace not detected in:\\n  ${workspace}/Forc.toml`;\n\n      const swayProgramType = readSwayType(workspace);\n      const exampleMsg = `Try using '${swayProgramType}s' instead of 'workspace' in:\\n  ${configPath}`;\n\n      throw new FuelError(\n        FuelError.CODES.WORKSPACE_NOT_DETECTED,\n        [workspaceMsg, exampleMsg].join('\\n\\n')\n      );\n    }\n\n    const swayMembers = forcToml.workspace.members.map((member) => resolve(workspace, member));\n\n    swayMembers\n      .map((path) => ({ path, type: readSwayType(path) }))\n      .filter(({ type }) => type !== SwayType.library)\n      .forEach(({ path, type }) => config[`${type as Exclude<SwayType, 'library'>}s`].push(path));\n\n    config.workspace = workspace;\n  }\n\n  return config;\n}\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/fuels/src/cli/config/loadConfig.ts#L82-L118","documentation":"Thrown during config resolution when fuels.config.ts declares a `workspace` but the Forc.toml at that workspace path has no `[workspace]` section. The loader reads the manifest, sees no workspace members, and tells you the path points at a single Sway program (contract/script/predicate) rather than a workspace.","triggerScenarios":"Setting `workspace: './path'` in fuels.config.ts where ./path/Forc.toml describes a single program (it has `[contract]`/`[script]`/`[predicate]`, not `[workspace]`).","commonSituations":"Configuring a single program as a workspace, copied config from a workspace template into a single-program repo, refactored a workspace down to one program without updating config.","solutions":["Switch the config key from `workspace` to the matching plural key (`contracts`, `scripts`, or `predicates`) — the error message tells you the detected type.","Or restructure the program into a real Forc workspace with a `[workspace] members = [...]` section."],"exampleFix":"// before — Forc.toml has [contract], not [workspace]\nexport default createConfig({ workspace: './my-contract' });\n// after\nexport default createConfig({ contracts: ['./my-contract'] });","handlingStrategy":"validation","validationCode":"import { existsSync, readFileSync } from 'fs';\nimport { join } from 'path';\nfunction isWorkspace(path: string): boolean {\n  if (!existsSync(join(path, 'Forc.toml'))) return false;\n  return /\\[workspace\\]/.test(readFileSync(join(path, 'Forc.toml'), 'utf8'));\n}","typeGuard":"const isWorkspaceConfig = (cfg: unknown): cfg is { workspace: string } =>\n  !!cfg && typeof cfg === 'object' && typeof (cfg as any).workspace === 'string';","tryCatchPattern":null,"preventionTips":["Use `workspace:` only when Forc.toml has a [workspace] section.","For single programs, use contracts/scripts/predicates instead.","After restructuring, audit fuels.config.ts keys against the manifest."],"tags":["cli","config","workspace","forc"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}