{"record":{"id":"dfde84b2027690b2","repo":"paperclipai/paperclip","slug":"missing-companyid-in-path-use-api-companies-com","errorCode":null,"errorMessage":"Missing companyId in path. Use /api/companies/{companyId}/issues.","messagePattern":"Missing companyId in path\\. Use /api/companies/(.+?)/issues\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/src/routes/companies.ts","lineNumber":412,"sourceCode":"    }\n    const allowed = new Set(req.actor.companyIds ?? []);\n    res.json(result.filter((company) => allowed.has(company.id)));\n  });\n\n  router.get(\"/stats\", async (req, res) => {\n    assertBoard(req);\n    const allowed = req.actor.source === \"local_implicit\" || req.actor.isInstanceAdmin\n      ? null\n      : new Set(req.actor.companyIds ?? []);\n    const stats = await svc.stats();\n    if (!allowed) {\n      res.json(stats);\n      return;\n    }\n    const filtered = Object.fromEntries(Object.entries(stats).filter(([companyId]) => allowed.has(companyId)));\n    res.json(filtered);\n  });\n\n  // Common malformed path when companyId is empty in \"/api/companies/{companyId}/issues\".\n  router.get(\"/issues\", (_req, res) => {\n    res.status(400).json({\n      error: \"Missing companyId in path. Use /api/companies/{companyId}/issues.\",\n    });\n  });\n\n  router.get(\"/:companyId/artifacts\", async (req, res) => {\n    const companyId = req.params.companyId as string;\n    assertCompanyAccess(req, companyId);\n    const query = companyArtifactsQuerySchema.parse(req.query);\n    res.json(await artifacts.list(companyId, query, {\n      userId: query.starred && req.actor.type === \"board\" ? req.actor.userId : undefined,\n    }));\n  });\n\n  router.get(\"/:companyId/timeline\", async (req, res) => {\n    const companyId = req.params.companyId as string;","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/companies.ts#L394-L430","documentation":"Path-shape diagnostic on GET /api/companies/issues: this route only exists to catch the common malformed URL where the companyId segment is empty, which lands the request on /issues instead of /companies/{companyId}/issues. It tells the caller to include the company id in the path.","triggerScenarios":"Thrown at server/src/routes/companies.ts:380 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include the required field(s) in the request path, query, or body as named by the error message, then retry.","Check the API contract in packages/shared validators for the exact required shape of this endpoint."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}