podman-container-tools/podman · error · Exception
'{matchobj[0]}' does not match 'pod' in either side
Error message
'{matchobj[0]}' does not match 'pod' in either side What it means
Raised by replace_type()'s replwith() callback when neither side of a '<<lhs|rhs>>' token matches '.*pod([^m]|$)' case-insensitively. Every <<a|b>> token is required to disambiguate a pod-specific vs container-specific phrasing; 'pod' must appear in exactly one half. Typos like 'podd', 'Pod.' (actually 'Pod.' matches: d follows), 'containr pod' — the real non-matches are sides where 'pod' is absent or only occurs inside the word 'podman'.
Source
Thrown at hack/markdown-preprocess:264
lhs = lhs[2:]
rhs = rhs[:len(rhs)-2]
# Check both sides for 'pod' followed by (non-"m" or end-of-string).
# The non-m prevents us from triggering on 'podman', which could
# conceivably be present in both sides. And we check for 'pod',
# not 'container', because it's possible to have something like
# <<container in pod|container>>.
if re.match('.*pod([^m]|$)', lhs, re.IGNORECASE):
if re.match('.*pod([^m]|$)', rhs, re.IGNORECASE):
raise Exception(f"'{matchobj[0]}' matches 'pod' in both left and right sides")
# Only left-hand side has "pod"
if self.pod_or_container == 'pod':
return lhs
return rhs
# 'pod' not in lhs, must be in rhs
if not re.match('.*pod([^m]|$)', rhs, re.IGNORECASE):
raise Exception(f"'{matchobj[0]}' does not match 'pod' in either side")
if self.pod_or_container == 'pod':
return rhs
return lhs
return re.sub(r'<<[^\|>]*\|[^\|>]*>>', replwith, line)
def main():
"script entry point"
script_dir = os.path.abspath(os.path.dirname(__file__))
man_dir = os.path.join(script_dir,"../docs/source/markdown")
try:
os.chdir(man_dir)
except FileNotFoundError as ex:
raise Exception("Please invoke me from the base repo dir") from ex
# No longer possible to invoke us with args: reject any such invocationView on GitHub (pinned to a2409076ef)
Solutions
- Restructure so one half contains 'pod' (not as part of 'podman'): '<<pod foo|container foo>>'
- If no pod/container distinction is intended, remove the << >> and write plain text
Example fix
# before <<run in the sandbox|run in the sandbox>> # after run in the sandbox
Defensive patterns
Strategy: validation
Validate before calling
import re, pathlib, sys
pat = re.compile(r'<<[^|>]*\|[^|>]*>>')
pod = re.compile(r'.*pod([^m]|$)', re.IGNORECASE)
bad = []
for p in pathlib.Path('docs/source/markdown/options').glob('*.md'):
for line_no, line in enumerate(p.read_text().splitlines(), 1):
for tok in pat.findall(line):
lhs, rhs = tok[2:-2].split('|')
if not pod.match(lhs) and not pod.match(rhs):
bad.append(f'{p}:{line_no}: pod in neither side: {tok}')
if bad:
sys.exit('\n'.join(bad)) Prevention
- Never use <<a|b>> as a generic alternation marker; the preprocessor assigns it one meaning only
- When both variants read the same, write the literal text without << >>
- Remember 'podman' does not count as containing 'pod' — if both halves only mention podman, restructure
When it happens
Trigger: An options/*.md line contains '<<foo|bar>>' with no 'pod' substring outside 'podman' in either half — e.g. '<<list the pods|>>' style mistakes aside, typically '<<--podman-opt|--podman-option>>' (only 'podman' present) or a token written purely for emphasis. Errors surface wrapped in the 'Error while processing ... line' wrapper from process().
Common situations: Authors using <<a|b>> as a generic alternation/emphasis marker instead of the pod-vs-container switch; both sides written with 'podman' prefixed wording; leftover experimental tokens in shared option files.
Related errors
- '{matchobj[0]}' matches 'pod' in both left and right sides
- undefined variable: {name}
- `else` without `if`
- multiple `else` in the same `if`
- `end` without `if`
AI-assisted analysis of podman-container-tools/podman@a2409076ef (2026-08-15).
Data as JSON: /api/errors/34cb8b3c9e344bd3.
Report an issue: GitHub.