{"record":{"id":"4078fc0c035a1c9b","repo":"can1357/oh-my-pi","slug":"invalid-glob-pattern-error","errorCode":null,"errorMessage":"invalid glob `{pattern}`: {error}","messagePattern":"invalid glob `(.+?)`: (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/pi-ast/src/ops.rs","lineNumber":378,"sourceCode":"\t\t\t.unwrap_or(&absolute_path)\n\t\t\t.to_string_lossy()\n\t\t\t.replace('\\\\', \"/\");\n\t\tif globset.is_match(&relative_path)\n\t\t\t|| patterns.iter().any(|pattern| pattern == &relative_path)\n\t\t{\n\t\t\tfiles.push(MatchedFile { absolute_path, relative_path });\n\t\t}\n\t}\n\tfiles.sort_unstable_by(|left, right| left.relative_path.cmp(&right.relative_path));\n\tOk(files)\n}\n\nfn build_globset(patterns: &[String]) -> Result<GlobSet, std::io::Error> {\n\tlet mut builder = GlobSetBuilder::new();\n\tfor pattern in patterns {\n\t\tif has_glob_syntax(pattern) {\n\t\t\tlet glob = Glob::new(pattern).map_err(|error| {\n\t\t\t\tstd::io::Error::new(\n\t\t\t\t\tstd::io::ErrorKind::InvalidInput,\n\t\t\t\t\tformat!(\"invalid glob `{pattern}`: {error}\"),\n\t\t\t\t)\n\t\t\t})?;\n\t\t\tbuilder.add(glob);\n\t\t}\n\t}\n\tbuilder.build().map_err(std::io::Error::other)\n}\n\n#[must_use]\npub fn has_glob_syntax(pattern: &str) -> bool {\n\tpattern.contains('*') || pattern.contains('?') || pattern.contains('[')\n}\n\nfn compile_rust_contextual_pattern(pattern: &str) -> Option<Pattern> {\n\tlet language = SupportLang::Rust;\n\tlet context = format!(\"fn __rwp_wrapper() {{ {pattern}; }}\");","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-ast/src/ops.rs#L360-L396","documentation":"Frames of type 'rpc_chunk' are a protocol v2 (streaming chunk) feature enabled during negotiation. Receiving one while _protocol_v2_enabled is False means the server began speaking v2 without the client having negotiated it, so the client raises RpcError rather than misparsing the stream.","triggerScenarios":"Server version newer than the client emits rpc_chunk frames despite no v2 handshake (or handshake response lost/ignored); forcing legacy mode client-side against a v2-only server; server bug skipping the initialize/negotiation exchange.","commonSituations":"Version skew after upgrading the server binary but not the Python client, or pinning protocol=v1 for compatibility while the server defaults to v2 streaming.","solutions":["Upgrade the Python client (omp_rpc) so protocol v2 negotiation is supported, or enable v2 in client options if available.","Downgrade/configure the server to speak protocol v1, matching the client.","Verify the negotiation exchange completes before the server sends commands (initialize handshake order).","Catch RpcError and log the first frames to confirm which side skipped negotiation."],"exampleFix":"// before\nclient = RpcClient(cmd, protocol_v2=False)  # server speaks v2 chunks\n// after\nclient = RpcClient(cmd, protocol_v2=True)  # or upgrade client so negotiation enables v2","handlingStrategy":"try-catch","validationCode":"# check protocol support before connecting\nif server_supports_v2 and not client_supports_v2:\n    raise RuntimeError(\"upgrade omp_rpc client: server requires protocol v2 (rpc_chunk frames)\")","typeGuard":"def protocol_negotiated(client: RpcClient) -> bool:\n    return client._protocol_v2_enabled or not server_requires_v2","tryCatchPattern":"try:\n    result = await client.request(\"prompt\", payload)\nexcept RpcError as exc:\n    if \"protocol negotiation\" in str(exc):\n        raise RuntimeError(\"client/server protocol version mismatch — align versions\") from exc\n    raise","preventionTips":["Keep the Python client and server binary versions in lockstep; upgrade both together.","Don't pin legacy protocol mode against newer servers that stream rpc_chunk frames.","Log the negotiated protocol after handshake and fail fast if it differs from expectations."],"tags":["rpc","protocol","versioning","negotiation"],"backgroundTag":"protocol-version-mismatch","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}