{"record":{"id":"97df23e082a9ef75","repo":"deepseek-ai/deepseek-harness","slug":"dsh-scope-scope-key-is-already-bound-to-a-parent","errorCode":null,"errorMessage":"dsh-scope: scope key is already bound to a parent; re-linking requires the binding returned by the original bind","messagePattern":"dsh-scope: scope key is already bound to a parent; re-linking requires the binding returned by the original bind","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/scope/src/index.ts","lineNumber":74,"sourceCode":"    if (cursor === key) throw new Error('dsh-scope: scope parent link would form a cycle')\n  }\n  scopeParents.set(key, parent)\n}\n\n/**\n * Bind `parent` as `key`'s enclosing scope, once.\n *\n * A key that already has a parent throws: there is no open re-link path, so a\n * scope's ancestry cannot be moved by anyone but the original binder, who\n * alone receives the {@link ScopeParentBinding}. A link that would close a\n * cycle is rejected, because every chain consumer walks parents to the root.\n * @param key - the child scope key.\n * @param parent - its enclosing scope key.\n * @returns the binding that alone may re-link this key.\n */\nexport function bindScopeParent(key: ScopeKey, parent: ScopeKey): ScopeParentBinding {\n  if (scopeParents.has(key)) {\n    throw new Error('dsh-scope: scope key is already bound to a parent; re-linking requires the binding returned by the original bind')\n  }\n  linkScopeParent(key, parent)\n  return {\n    rebind(next: ScopeKey): void {\n      linkScopeParent(key, next)\n    },\n  }\n}\n\n/**\n * Read one key's enclosing scope.\n * @param key - the scope key to inspect.\n * @returns its parent key, or `undefined` for a root scope.\n */\nexport function scopeParentOf(key: ScopeKey): ScopeKey | undefined {\n  return scopeParents.get(key)\n}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/scope/src/index.ts#L56-L92","documentation":"Error \"dsh-scope: scope key is already bound to a parent; re-linking requires the binding returned by the original bind\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/scope/src/index.ts:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the binding returned by the original bind to re-link the scope key."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}