{"record":{"id":"d3cd6a8b2acedb04","repo":"d2lang/d2","slug":"expected-double-border-to-be-true-or-false","errorCode":null,"errorMessage":"expected \"double-border\" to be true or false","messagePattern":"expected \"double-border\" to be true or false","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"d2graph/d2graph.go","lineNumber":480,"sourceCode":"\t\t\treturn errors.New(`expected \"underline\" to be true or false`)\n\t\t}\n\t\ts.Underline.Value = value\n\tcase \"filled\":\n\t\tif s.Filled == nil {\n\t\t\tbreak\n\t\t}\n\t\t_, err := strconv.ParseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.New(`expected \"filled\" to be true or false`)\n\t\t}\n\t\ts.Filled.Value = value\n\tcase \"double-border\":\n\t\tif s.DoubleBorder == nil {\n\t\t\tbreak\n\t\t}\n\t\t_, err := strconv.ParseBool(value)\n\t\tif err != nil {\n\t\t\treturn errors.New(`expected \"double-border\" to be true or false`)\n\t\t}\n\t\ts.DoubleBorder.Value = value\n\tcase \"text-transform\":\n\t\tif s.TextTransform == nil {\n\t\t\tbreak\n\t\t}\n\t\tif !go2.Contains(d2ast.TextTransforms, strings.ToLower(value)) {\n\t\t\treturn fmt.Errorf(`expected \"text-transform\" to be one of (%s)`, strings.Join(d2ast.TextTransforms, \", \"))\n\t\t}\n\t\ts.TextTransform.Value = value\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown style key: %s\", key)\n\t}\n\n\treturn nil\n}\n\ntype ContainerLevel int","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/d2lang/d2/blob/0d69dca6f532ceaeacd615d35d1eaa41a238ffdb/d2graph/d2graph.go#L462-L498","documentation":"This error comes from applying the `double-border` style to a shape in d2graph. The value assigned to `double-border` must parse as a boolean (true/false); strconv.ParseBool failed, so the value was rejected before being stored on the style.","triggerScenarios":"Calling Set on a style map key `double-border` with a value that is not one of 1/t/T/TRUE/true/True/0/f/F/FALSE/false/False, e.g. `shape.Style.DoubleBorder.Value = \"yes\"` or setting it via a script/API with a non-boolean string.","commonSituations":"Typing `double-border: yes` or `double-border: on` in a d2 config; passing user-supplied strings from a UI into the style setter; confusing double-border (boolean) with border-radius (number).","solutions":["Change the value to exactly `true` or `false` (also accepted: 1/0, T/F, TRUE/FALSE case-insensitively).","If the intent was to enable the border, write `style.double-border: true`.","If the value comes from user input, validate it with strconv.ParseBool before calling Set.","Check you are not setting a string like \"yes\"/\"on\"; d2 does not accept those."],"exampleFix":"// before\nstyle: { double-border: \"yes\" }\n// after\nstyle: { double-border: true }","handlingStrategy":"validation","validationCode":"func validBool(v string) bool { _, err := strconv.ParseBool(v); return err == nil }\nif !validBool(value) { value = \"true\" } // normalize before Set","typeGuard":"func isD2Bool(v string) bool {\n  switch strings.ToLower(v) {\n  case \"true\", \"false\", \"1\", \"0\", \"t\", \"f\": return true\n  }\n  return false\n}","tryCatchPattern":"if err := obj.Set(ctx, \"style.double-border\", val); err != nil && strings.Contains(err.Error(), \"double-border\") {\n  // fall back to a boolean default or surface a user-facing validation message\n}","preventionTips":["Always pass literal true/false for double-border.","Validate user input with strconv.ParseBool before calling Set.","Don't confuse double-border with other style keys that accept non-boolean values."],"tags":["d2","validation","style","boolean-parse"],"backgroundTag":"invalid-boolean-value","analyzedSha":"0d69dca6f532ceaeacd615d35d1eaa41a238ffdb","analyzedAt":"2026-08-31T12:19:21.182Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}