{"record":{"id":"3f6e245ddda7817c","repo":"paperclipai/paperclip","slug":"companyid-is-required-for-this-operation","errorCode":null,"errorMessage":"companyId is required for this operation","messagePattern":"companyId is required for this operation","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-host-services.ts","lineNumber":766,"sourceCode":"  const projects = projectService(db);\n  const executionWorkspaces = executionWorkspaceService(db);\n  const issues = issueService(db);\n  const documents = documentService(db);\n  const goals = goalService(db);\n  const access = accessService(db);\n  const authorization = authorizationService(db);\n  const budgets = budgetService(db);\n  const issueApprovals = issueApprovalService(db);\n  const approvalSvc = approvalService(db);\n  const interactions = issueThreadInteractionService(db);\n  const scopedBus = eventBus.forPlugin(pluginKey);\n\n  // Track active session event subscriptions for cleanup\n  const activeSubscriptions = new Set<{ unsubscribe: () => void; timer: ReturnType<typeof setTimeout> }>();\n  let disposed = false;\n\n  const ensureCompanyId = (companyId?: string) => {\n    if (!companyId) throw new Error(\"companyId is required for this operation\");\n    return companyId;\n  };\n\n  const parseWindowValue = (value: unknown): number | null => {\n    if (typeof value === \"number\" && Number.isFinite(value)) {\n      return Math.max(0, Math.floor(value));\n    }\n    if (typeof value === \"string\" && value.trim().length > 0) {\n      const parsed = Number(value);\n      if (Number.isFinite(parsed)) {\n        return Math.max(0, Math.floor(parsed));\n      }\n    }\n    return null;\n  };\n\n  const applyWindow = <T>(rows: T[], params?: { limit?: unknown; offset?: unknown }): T[] => {\n    const offset = parseWindowValue(params?.offset) ?? 0;","sourceCodeStart":748,"sourceCodeEnd":784,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/services/plugin-host-services.ts#L748-L784","documentation":"buildHostServices was constructed without a companyId. All plugin host service API calls are company-scoped, so this guard rejects any operation attempted before a company context is bound.","triggerScenarios":"Thrown at server/src/services/plugin-host-services.ts:757 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide companyId in the request/context for this plugin host service operation."],"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"}