{"record":{"id":"5f109596bd59f18a","repo":"theonedev/onedev","slug":"flag-0-not-from-this-walk","errorCode":null,"errorMessage":"Flag {0} not from this walk","messagePattern":"Flag (.+?) not from this walk","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java","lineNumber":1449,"sourceCode":"\t\tfreeFlags &= ~m;\n\t\treturn m;\n\t}\n\n\t/**\n\t * Automatically carry a flag from a child commit to its parents.\n\t * <p>\n\t * A carried flag is copied from the child commit onto its parents when the\n\t * child commit is popped from the lowest level of walk's internal graph.\n\t *\n\t * @param flag\n\t *            the flag to carry onto parents, if set on a descendant.\n\t */\n\tpublic void carry(RevFlag flag) {\n\t\tif ((freeFlags & flag.mask) != 0)\n\t\t\tthrow new IllegalArgumentException(MessageFormat\n\t\t\t\t\t.format(JGitText.get().flagIsDisposed, flag.name));\n\t\tif (flag.walker != this)\n\t\t\tthrow new IllegalArgumentException(MessageFormat\n\t\t\t\t\t.format(JGitText.get().flagNotFromThis, flag.name));\n\t\tcarryFlags |= flag.mask;\n\t}\n\n\t/**\n\t * Automatically carry flags from a child commit to its parents.\n\t * <p>\n\t * A carried flag is copied from the child commit onto its parents when the\n\t * child commit is popped from the lowest level of walk's internal graph.\n\t *\n\t * @param set\n\t *            the flags to carry onto parents, if set on a descendant.\n\t */\n\tpublic void carry(Collection<RevFlag> set) {\n\t\tfor (RevFlag flag : set)\n\t\t\tcarry(flag);\n\t}\n","sourceCodeStart":1431,"sourceCodeEnd":1467,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java#L1431-L1467","documentation":"RevWalk flags are bound to the RevWalk instance that created them (flag.walker). Calling carry(flag) with a flag created by a different RevWalk throws this IllegalArgumentException, since the mask may collide with flags of this walk.","triggerScenarios":"Passing a RevFlag from one RevWalk instance to carry() of another; creating a new RevWalk (e.g. per request) but reusing cached RevFlag constants from an old walk; two walks opened on the same repository and flags crossed between them.","commonSituations":"Framework code caching static RevFlag fields while constructing a new RevWalk each request; tests sharing flags across walks.","solutions":["Create the flag from the same walk instance: thisWalk.newFlag(name).","Store flag names, not RevFlag objects, in caches; call newFlag per walk.","Restructure so flags and walks have the same lifecycle."],"exampleFix":"// before\nprivate static final RevFlag SEEN = ...walk.newFlag(\"SEEN\");\notherWalk.carry(SEEN); // throws\n// after\nRevFlag seen = otherWalk.newFlag(\"SEEN\");\notherWalk.carry(seen);","handlingStrategy":"type-guard","validationCode":"if (flag.walker != thisWalk)\n    flag = thisWalk.newFlag(flag.getName());\nthisWalk.carry(flag);","typeGuard":"RevFlag rebind(RevWalk w, RevFlag f) { return f.walker == w ? f : w.newFlag(f.getName()); }","tryCatchPattern":"try {\n    walk.carry(flag);\n} catch (IllegalArgumentException e) {\n    flag = walk.newFlag(flag.getName()); // recreate for this walk\n    walk.carry(flag);\n}","preventionTips":["Never cache RevFlag objects in static/application scope; cache names","Create flags from the exact walk instance being used","Keep flag and walk lifecycles aligned"],"tags":["git","revflag","wrong-instance"],"backgroundTag":"invalid-flag-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}