{"record":{"id":"422a9301b647b7df","repo":"elastic/elasticsearch","slug":"continued-snippets-can-t-be-skipped","errorCode":null,"errorMessage":"Continued snippets can't be skipped","messagePattern":"Continued snippets can't be skipped","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/RestTestsFromDocSnippetTask.java","lineNumber":277,"sourceCode":"                    current.println(\"\\\"\" + test.name() + \"\\\":\");\n                } else {\n                    current.println(\"\\\"line_\" + test.start() + \"\\\":\");\n                }\n                /* The Elasticsearch test runner doesn't support quite a few\n                 * constructs unless we output this skip. We don't know if\n                 * we're going to use these constructs, but we might so we\n                 * output the skip just in case. */\n                current.println(\"  - skip:\");\n                current.println(\"      features:\");\n                current.println(\"        - default_shards\");\n                current.println(\"        - stash_in_key\");\n                current.println(\"        - stash_in_path\");\n                current.println(\"        - stash_path_replace\");\n                current.println(\"        - warnings\");\n            }\n            if (test.skip() != null) {\n                if (test.continued()) {\n                    throw new InvalidUserDataException(\"Continued snippets \" + \"can't be skipped\");\n                }\n                current.println(\"        - always_skip\");\n                current.println(\"      reason: \" + test.skip());\n            }\n            if (test.setup() != null) {\n                setup(test);\n            }\n\n            body(test, false);\n\n            if (test.teardown() != null) {\n                teardown(test);\n            }\n        }\n\n        private void response(Snippet response) {\n            if (null == response.skip()) {\n                current.println(\"  - match:\");","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/doc/RestTestsFromDocSnippetTask.java#L259-L295","documentation":"In TestBuilder.test, if test.skip() is non-null AND test.continued() is true, the throw fires. A continued snippet appends its steps to the previous test's YAML, so it cannot carry its own 'always_skip' directive — the skip semantics belong to the whole test, not a continuation fragment.","triggerScenarios":"A single snippet is annotated with both // TEST[continued] and a skip directive (e.g. // TEST[continued,skip:reason]).","commonSituations":"Trying to skip a continuation fragment independently of its base test; combining flags without realizing they conflict.","solutions":["Move the skip directive onto the base (first, non-continued) test snippet in the chain instead of the continued fragment.","Remove // TEST[continued] if this snippet must be skipped on its own (making it a standalone test)."],"exampleFix":"// before — skip on a continued fragment\n// CONSOLE\nPOST /idx/_doc\n{ \"a\": 1 }\n// CONSOLE\n// TEST[continued,skip:feature-x]\nGET /idx/_search\n\n// after — skip on the base test\n// CONSOLE\n// TEST[skip:feature-x]\nPOST /idx/_doc\n{ \"a\": 1 }\n// CONSOLE\n// TEST[continued]\nGET /idx/_search","handlingStrategy":"validation","validationCode":"// Reject snippets that combine 'continued' and 'skip'\nvoid checkContinuedNotSkipped(SnippetInfo s, String filePath) {\n    if (s.continued && s.skip != null) {\n        throw new IllegalStateException(\n            \"Snippet \" + s.path + \" in \" + filePath\n            + \" is both continued and skipped — move skip to the base test\");\n    }\n}","typeGuard":"boolean continuedAndSkipCompatible(boolean continued, String skip) {\n    return !(continued && skip != null);\n}","tryCatchPattern":null,"preventionTips":["Put skip directives only on the base (first, non-continued) test of a chain.","Remember continued fragments append to the base test — they inherit its skip status.","Never combine // TEST[continued] with a skip flag on the same snippet."],"tags":["docs","snippet","skip","continued","console"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}