{"record":{"id":"1562e9778019cd16","repo":"paperclipai/paperclip","slug":"selected-runtime-service-is-not-defined-in-this-ex","errorCode":null,"errorMessage":"Selected runtime service is not defined in this execution workspace runtime config","messagePattern":"Selected runtime service is not defined in this execution workspace runtime config","errorType":"http","errorClass":null,"httpStatus":422,"severity":"error","filePath":"server/src/routes/execution-workspaces.ts","lineNumber":359,"sourceCode":"    if (target.runtimeServiceId && !(existing.runtimeServices ?? []).some((service) => service.id === target.runtimeServiceId)) {\n      res.status(404).json({ error: \"Runtime service not found for this execution workspace\" });\n      return;\n    }\n    const matchedRuntimeService =\n      workspaceCommand?.kind === \"service\" && !target.runtimeServiceId\n        ? matchWorkspaceRuntimeServiceToCommand(workspaceCommand, existing.runtimeServices ?? [])\n        : null;\n    const selectedRuntimeServiceId = target.runtimeServiceId ?? matchedRuntimeService?.id ?? null;\n    const selectedServiceIndex =\n      workspaceCommand?.kind === \"service\"\n        ? workspaceCommand.serviceIndex\n        : target.serviceIndex ?? null;\n    if (\n      selectedServiceIndex !== undefined\n      && selectedServiceIndex !== null\n      && (selectedServiceIndex < 0 || selectedServiceIndex >= configuredServices.length)\n    ) {\n      res.status(422).json({ error: \"Selected runtime service is not defined in this execution workspace runtime config\" });\n      return;\n    }\n    if (workspaceCommand?.kind === \"job\" && action !== \"run\") {\n      res.status(422).json({ error: `Workspace job \"${workspaceCommand.name}\" can only be run` });\n      return;\n    }\n    if (workspaceCommand?.kind === \"service\" && action === \"run\") {\n      res.status(422).json({ error: `Workspace service \"${workspaceCommand.name}\" should be started or restarted, not run` });\n      return;\n    }\n    if (action === \"run\" && !workspaceCommand) {\n      res.status(422).json({ error: \"Select a workspace job to run\" });\n      return;\n    }\n\n    if ((action === \"start\" || action === \"restart\") && !effectiveRuntimeConfig) {\n      res.status(422).json({ error: \"Execution workspace has no workspace command configuration or inherited project workspace default\" });\n      return;","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/execution-workspaces.ts#L341-L377","documentation":"The resolved serviceIndex is outside the configured runtime service entries (negative or >= configuredServices.length), i.e. the index does not address a service defined in the effective workspace runtime config (workspace config or project policy fallback).","triggerScenarios":"Thrown at server/src/routes/execution-workspaces.ts:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the request so it satisfies the condition stated in the error message, then retry; see the throwing line in the named file for the exact check."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}