ChatGPTClaudeGrok / X / CursorGemini

DeepSeek Harness BAD_INDENT: Profile Cannot Be Saved

TroubleshootingPublished 2026-11-03Author: DeepSeek Plugin Market
DeepSeek HarnessBAD_INDENTjs-yamlyaml.parseDocumentprofile save failureflow indentation
A DeepSeek Harness profile loads at runtime but cannot be saved: BAD_INDENT, because js-yaml and yaml.parseDocument() disagree about flow bracket indentation.

DeepSeek Harness (DSH) has a counterintuitive combination: the same profile loads normally at runtime, but saving it in Settings fails with BAD_INDENT and the configuration never makes it back to disk. Your YAML is not broken as a whole; loading and editing go through two different parsers. According to the user report, profile loading uses js-yaml with the profile schema, while packages/boot/config-editor/src/index.ts parses the same text with yaml.parseDocument() before saving; for an under-indented closing bracket inside a nested flow collection, the first accepts it and the second rejects it with Flow sequence in block collection must be sufficiently indented and end with a ]. Every technical detail in this article comes from that user's unilateral report plus their own verification, with no third-party review — read it with that in mind (#11625).

The test: starting fine does not mean saving fine, because two parsers each own half

In one sentence: BAD_INDENT only appears at the "save" step, which puts the problem in the editor's parsing rather than in runtime loading. Three parts:

  1. Check when the failure occurs. Expected: startup is fine, sessions work, models can be called, and it fails only when you press save in Settings. If it crashes during startup instead, change direction to profile manifest BOM.
  2. Check whether provider credentials are involved. The reporter states explicitly that the minimal reproduction contains no provider credentials and issues no GLM / OpenAI / Anthropic requests. So the failure is in local config editing, not in an API call.
  3. Check whether the error code is about indentation. Expected: BAD_INDENT. If you see settings/rejected or next is not a function, that is a different mechanism — see settings that snap back immediately. Once all three match, stop looking at credentials, the network and the model.

Minimal reproduction: hand the same YAML to two parsers

The decisive signal: js-yaml's load() reads the array fine while yaml's parseDocument() returns BAD_INDENT. Steps (reporter's environment: dsh-v0.2.2-alpha.2, js-yaml 4.3.2, yaml 2.9.0):

  1. Prepare a YAML snippet constructed from scratch, not a real profile excerpt.
yaml
- id: example
  config: {
    models: [
    { id: model-a }
    ]
  }
  1. Read it once with js-yaml.
js
import yaml from 'js-yaml'
console.log(Array.isArray(yaml.load(source)))   // true

Expected: true. The runtime path considers this text legal.

  1. Read it once with the yaml document parser.
js
import { parseDocument } from 'yaml'
console.log(parseDocument(source).errors[0]?.code)   // BAD_INDENT

Expected: BAD_INDENT. The save path considers it illegal.

  1. Confirm the difference is exactly the closing bracket. Indent the closing ] to match what the flow collection requires; expected: parseDocument returns no errors. That proves the problem is not "the whole config is garbage" but the indentation of one closing bracket.

The mechanism: how a nested flow collection's closing bracket is indented

In one sentence: when a flow collection is nested in a block collection, its closing bracket has an indentation requirement, and the two parsers tolerate "a little short" differently, so one file passes on one side and fails on the other. Step by step:

  1. { and [ open flow context. Here the value of config: is a flow mapping containing a flow sequence, which in turn embeds a flow mapping.
  2. The closing ] needs sufficient indentation. The spec requires a flow collection inside a block collection to be "sufficiently indented", and when the closing bracket sits too far left the yaml package rules it invalid.
  3. js-yaml chooses to tolerate. Runtime loading uses it, so the profile reads fine and the app starts normally.
  4. ConfigEditor uses the document model and has to be strict. It needs to preserve comments and formatting, so it goes through parseDocument(), which errors on an invalid node and aborts the save.
  5. Hence "readable but not writable". This is not data corruption; it is two components disagreeing about what counts as legal for the same text.

The reporter classifies it as a compatibility problem and proposes two directions: either have the editor and runtime share one accepted grammar, or add a narrow, semantically validated compatibility repair path.

Repair one: align only the closing bracket, do not rewrite the block

In one sentence: the minimal change is to top up the indentation of the closing ] on the offending line; do not rewrite the whole provider block just to silence the error, since that easily loses fields and comments. Steps:

  1. Back up the profile file first, copying it outside the workspace.
  2. Save once from the Settings page and record the error. Expected: BAD_INDENT with position information (a line number or context). Note that the error message should not contain the config source snippet; if it does, that is a separate UX problem.
  3. Locate the line holding the closing bracket. Change only the leading spaces on that line so ] meets the indentation the enclosing flow collection requires.
  4. Recheck with yaml.parseDocument(). Expected: errors is empty.
  5. Go back to Settings and save again. Expected: the save succeeds and the config file gains the expected new key.

Why insist on "change one line": per the user report, making a user rewrite the whole provider block risks losing unrelated fields and comments. Keeping the change surface small is the first principle for this class of problem.

Repair two: four boundaries a local patch has to respect

In one sentence: if you add a compatibility path to the editor, it must stay within four boundaries — fix only delimiter-only lines, keep semantics identical after the fix, reuse unchanged nodes, and replace atomically. The reporter's local implementation:

  1. Fix only the pure-delimiter lines reported as BAD_INDENT. And first confirm that the lexer is really looking at a flow closing token; brackets inside quoted strings and block scalars do not count as delimiters.
  2. Cap the number of fixes and require that the runtime parser produces exactly the same value before and after. Any other malformed input is rejected before writing to disk.
  3. Reuse unmodified YAML nodes. This preserves comments, quote style, expressions and existing fields; when editing an ordinary block sequence, unrelated lines stay byte-for-byte identical.
  4. Fully validate the candidate content before replacing it atomically. If applying it fails, restore the previous bytes; report the syntax position in the error without including config source snippets.

The value of these four is that a compatibility path must not become "quietly rewriting the user's configuration". Failing any one of them can turn "the save failed" into "the save succeeded but the config was mangled", which is much harder to notice.

How far the verification goes: local evidence is not an official fix

In one sentence: the reporter completed 42 tests and an isolated-machine verification, but there is no upstream release record and you cannot infer that an official build contains the fix. The evidence list:

  1. Test scale: 4 configuration test files with 42 passing tests, covering real Loader save/restart, JSON and YAML, Unicode and multi-model entries, comment and unrelated-line preservation, and write-failure protection.
  2. Build gate: the full build and type check pass 10/10 gates.
  3. Install verification: on an isolated Windows install, with a synthesized legacy flow-style profile, they created a custom provider through the normal settings form, saved, reopened, exited the desktop app normally and restarted, and the config along with Unicode model entries, explicit capacity and comments all survived.
  4. No requests sent: across the whole save/reopen process, the loopback model stub received 0 requests — proving what was verified is the config editing path, not model calls.
  5. Explicitly not covered: no claim that a real GLM API call succeeds, and no claim that the fix has entered an upstream release.

So the correct phrasing is: "according to the user report, a local patch fixes it; whether an official build includes it requires the release notes", never "officially fixed".

Keep it separate from the other two "settings will not save" cases

In one sentence: BAD_INDENT is a parser difference, settings/rejected is a callback contract, and a startup crash is file encoding — three completely different entry points. Compare:

  1. BAD_INDENT: reported only at save time, the profile starts, and the same YAML gets opposite verdicts from two parsers.
  2. settings/rejected: next is not a function: HTTP 200 but the RPC returns ok:false, every setting fails, and it has nothing to do with YAML content.
  3. Unexpected token: it crashes at startup, the file begins with EF BB BF, and you cannot even reach the UI.

Classifying by the phase in which the error appears, before digging into the specific mechanism, is far more effective than starting by reading the config file.

Debugging notes

For problems backed by evidence from one side, the rule is "reproduce the parser difference first, then decide whether to edit the file". Six points:

  1. Suspect a parser difference before suspecting that your whole indentation is wrong when you see BAD_INDENT.
  2. Use a minimal YAML snippet for the comparison, not your real profile over and over.
  3. Change only the line with the closing bracket; rewriting the block loses comments and unrelated fields.
  4. Back up before editing and recheck with the document parser after, neither of which can be skipped.
  5. Separate "locally verified" from "officially fixed"; this article has no third-party review and no upstream release record.
  6. If this becomes a product capability, it must guarantee semantic equivalence, or it will turn a save failure into silent config rewriting.

Source: Discussion #11625.

ChatGPTClaudeGrok / X / CursorGemini

FAQ

DeepSeek Harness starts fine but BAD_INDENT blocks saving?

Because DeepSeek Harness loads and saves with two different YAML parsers. According to the user report, startup reads the file with js-yaml plus the profile schema, while the ConfigEditor parses the same text with yaml.parseDocument() before saving. For an under-indented closing bracket inside a nested flow collection, the first accepts and the second throws BAD_INDENT, which produces 'starts fine but cannot be saved'.

DeepSeek Harness BAD_INDENT: parser difference or bad YAML?

In DeepSeek Harness, feed the same profile snippet to both parsers: js-yaml's load() returns true meaning it read the array, while yaml's parseDocument() reports code BAD_INDENT in errors[0]. Contradictory verdicts on the same text prove it is a parser difference. This minimal reproduction needs no provider credentials and issues no model requests.

Fixing the closing ] enough for DeepSeek Harness BAD_INDENT?

In DeepSeek Harness, this works for the minimal example: give the closing ] enough indentation to satisfy the flow collection and yaml.parseDocument() stops reporting BAD_INDENT. But per the user report, making a user rewrite the whole provider block risks losing unrelated fields and comments, so the safer move is to adjust only the indentation of the line holding the closing bracket and keep every other original line.

Has the DeepSeek Harness BAD_INDENT bug been fixed?

As of that discussion DeepSeek Harness has no upstream release record. What the reporter provided is a local patch and local verification: 4 config files with 42 passing tests, 10/10 build and type-check gates, plus a save, reopen and restart check on an isolated Windows install. Those are local results and do not mean an official build already contains the fix.

Related Terms

BAD_INDENT
BAD_INDENT is the error code the yaml package returns for illegal indentation, usually with the full message Flow sequence in block collection must be sufficiently indented and end with a ]. It means the parser thinks the closing bracket of a flow collection is under-indented, not that the whole file's indentation is wrong.— https://github.com/deepseek-ai/deepseek-harness/discussions/11625
flow collection
A flow collection is YAML's inline notation using [ ] for sequences and { } for mappings, and it can nest inside block structure. When a flow collection sits inside a block collection, its closing bracket needs sufficient indentation, and different parsers can be stricter or looser about that.— https://github.com/deepseek-ai/deepseek-harness/discussions/11625
yaml.parseDocument
yaml.parseDocument is the document-level parsing entry in the yaml package; it returns an AST plus an errors array, which makes it convenient for editing while preserving comments and formatting. DeepSeek Harness' ConfigEditor parses the profile with it before saving, a different implementation from the js-yaml used at runtime.— https://github.com/deepseek-ai/deepseek-harness/discussions/11625

Sources