{"record":{"id":"b231121864e9ab8f","repo":"ajaxorg/ace","slug":"invalid-fold-style","errorCode":null,"errorMessage":"invalid fold style: ","messagePattern":"invalid fold style: ","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/edit_session/folding.js","lineNumber":835,"sourceCode":"                return false;\n            }\n        });\n    };\n    \n    // structured folding\n    this.$foldStyles = {\n        \"manual\": 1,\n        \"markbegin\": 1,\n        \"markbeginend\": 1\n    };\n    this.$foldStyle = \"markbegin\";\n    \n    /**\n     * @param {string} style\n     */\n    this.setFoldStyle = function(style) {\n        if (!this.$foldStyles[style])\n            throw new Error(\"invalid fold style: \" + style + \"[\" + Object.keys(this.$foldStyles).join(\", \") + \"]\");\n        \n        if (this.$foldStyle == style)\n            return;\n\n        this.$foldStyle = style;\n        \n        if (style == \"manual\")\n            this.unfold();\n        \n        // reset folding\n        var mode = this.$foldMode;\n        this.$setFolding(null);\n        this.$setFolding(mode);\n    };\n\n    /**\n     * @param {import(\"../../ace-internal\").Ace.FoldMode} foldMode\n     */","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/ajaxorg/ace/blob/2c1eddc392eb92cf222a4478f1893d2b2c354fb0/src/edit_session/folding.js#L817-L853","documentation":"setFoldStyle() validates the style against $foldStyles (currently 'manual' and 'markbegin'/'markbeginend' set). Passing any other string throws, listing the valid options in the message.","triggerScenarios":"Calling session.setFoldStyle('clickable') or any misspelled/unrecognized style name.","commonSituations":"Copying fold style names from other editors (CodeMirror, vim); guessing style names; typos like 'markBegin' with wrong casing.","solutions":["Use one of the valid styles: 'manual', 'markbegin', or 'markbeginend'","Check the error message listing allowed keys","Fix casing — names are lowercase"],"exampleFix":"// before\nsession.setFoldStyle('markers');\n// after\nsession.setFoldStyle('markbegin');","handlingStrategy":"validation","validationCode":"var FOLD_STYLES = ['manual', 'markbegin', 'markbeginend'];\nif (!FOLD_STYLES.includes(style)) throw new Error('bad fold style: ' + style);\nsession.setFoldStyle(style);","typeGuard":"function isValidFoldStyle(s) { return s === 'manual' || s === 'markbegin' || s === 'markbeginend'; }","tryCatchPattern":"try { session.setFoldStyle(style); } catch (e) { if (/invalid fold style/.test(e.message)) session.setFoldStyle('markbegin'); else throw e; }","preventionTips":["Use only 'manual', 'markbegin', or 'markbeginend'","Match the lowercase spelling exactly","Read the allowed values from the thrown error message"],"tags":["folding","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"2c1eddc392eb92cf222a4478f1893d2b2c354fb0","analyzedAt":"2026-08-30T00:39:52.222Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}