{"record":{"id":"1cc37fb0eb7ff2c5","repo":"ruvnet/ruflo","slug":"invalid-request","errorCode":"invalid-request","errorMessage":"${label} must be non-empty","messagePattern":"(.+?) must be non-empty","errorType":"exception","errorClass":"InMemoryFenceReferenceError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts","lineNumber":34,"sourceCode":"\nexport class InMemoryFenceReferenceError extends Error {\n  constructor(readonly reason: InMemoryFenceRefusal, detail: string) {\n    super(detail);\n  }\n}\n\ninterface StoredLease {\n  lease: FencedLease;\n  expiresAtMs: number;\n}\n\nfunction compare(left: string, right: string): number {\n  return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction text(value: string, label: string): string {\n  const result = value.trim();\n  if (!result) throw new InMemoryFenceReferenceError('invalid-request', `${label} must be non-empty`);\n  return result;\n}\n\nfunction normalizeScope(kind: LeaseRequest['kind'], value: string): string {\n  const scope = text(value, 'lease scope');\n  if (scope.startsWith('-') || scope.includes('\\\\') || scope !== scope.normalize('NFC')) {\n    throw new InMemoryFenceReferenceError('invalid-request', `unsafe lease scope: ${value}`);\n  }\n  if (kind === 'resource') {\n    if (scope.includes('/') || scope === '.' || scope === '..') {\n      throw new InMemoryFenceReferenceError('invalid-request', `invalid named resource: ${value}`);\n    }\n    return scope;\n  }\n  if (\n    scope.startsWith('/')\n    || scope.split('/').some((part) => !part || part === '.' || part === '..')\n  ) {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts#L16-L52","documentation":"The in-memory fenced-lease reference validates every identity string with a trim-and-non-empty check: repositoryId, sessionId, and workloadId (plus lease scopes via normalizeScope) on the acquire/renew paths. An empty or whitespace-only value throws InMemoryFenceReferenceError with reason 'invalid-request' and a message naming the failed field. This adapter is a single-process conformance reference; distributed adapters enforce the same request shape.","triggerScenarios":"Calling acquire with repositoryId: '' or a whitespace-only sessionId/workloadId; renew/release paths invoked with blank identity fields; requests assembled from optional variables that were never assigned and default to empty string.","commonSituations":"Session ids plumbed from optional CLI flags that default to ''; multi-repository loops where one repo's id is missing; user input trimmed to '' before being passed on.","solutions":["Check the field named in the message and supply a real value","Derive ids from stable sources (git remote, a session uuid) instead of optional flags","Apply the same trim-and-check guard when building requests so callers get your error message with context"],"exampleFix":"// before\nref.acquire({ repositoryId: '', kind: 'resource', scopes: ['db-main'], ttlMs: 30_000, sessionId: 's1', workloadId: 'w1' });\n\n// after\nref.acquire({ repositoryId: 'github.com/org/repo', kind: 'resource', scopes: ['db-main'], ttlMs: 30_000, sessionId: 's1', workloadId: 'w1' });","handlingStrategy":"try-catch","validationCode":"function isNonBlank(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","typeGuard":"function isNonBlank(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":"try { lease = ref.acquire(request); } catch (error) { if (error instanceof InMemoryFenceReferenceError && error.reason === 'invalid-request') { // fix the field named in error.message, then retry with a corrected request } throw error; }","preventionTips":["Default identity fields from stable sources (repo remote, session uuid) instead of optional flags","Guard requests with a non-blank check before calling the adapter","Distinguish reason 'invalid-request' from 'scope-conflict'/'stale-fence' — only the first means your payload is malformed"],"tags":["lease","fencing","validation","harness","invalid-request"],"backgroundTag":"empty-required-field","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}