deepseek-ai/deepseek-harness · error

settings: keeping last good

Error message

settings: keeping last good "%s" after invalid stored section

What it means

After applying a new document, a stored namespace section failed validation; the service keeps the last good section for that namespace and warns, so one malformed stored section cannot invalidate the whole settings document.

Solutions

  1. Fix the invalid stored section in the named settings file; the last good value is kept meanwhile.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/settings/settings/src/index.ts:677 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/772fe139ba5317b2. Report an issue: GitHub.

Appendix: source

Thrown at packages/settings/settings/src/index.ts:677

    // bump below compares what was stored with what now is — an external edit
    // moves the revision exactly like an in-process write.
    const before = new Map<SettingsNamespace, unknown>()
    for (const registration of this.registrations.values()) {
      try {
        before.set(registration.ns, this.section(registration.ns))
      } catch {
        // A malformed stored section is not a readable "before"; treating it
        // as absent still bumps against any well-formed replacement.
        before.set(registration.ns, undefined)
      }
    }
    this.document = doc
    for (const registration of this.registrations.values()) {
      let next: unknown
      try {
        next = deepFreeze(this.resolve(registration.schema, registration.base, this.section(registration.ns), registration.validate))
      } catch (error) {
        this.ctx.logger.warn('settings: keeping last good "%s" after invalid stored section', registration.ns)
        this.ctx.logger.warn(error)
        continue
      }
      this.bumpRevision(registration, before.get(registration.ns), this.section(registration.ns))
      this.commit(registration, next, source)
    }
  }

  /** Read one namespace's raw user section, rejecting non-object sections. */
  private section(ns: SettingsNamespace): Record<string, unknown> | undefined {
    const section = this.document[ns]
    if (section === undefined) return undefined
    if (!isPlainObject(section)) {
      throw new TypeError(`settings section "${ns}" must be an object of keys`)
    }
    return section
  }

View on GitHub (pinned to b150a551b8)