← Repo overview
/
langchain-ai/ langchain
/
search
@39701d6
7,521 matches across 25 files for error
snippet_mode: grep · sorted by relevance
105
106 def bad_code(inputs) -> int:
107 ▶ raise NotImplementedError('For demo purpose')
108
109 chain = RunnableLambda(bad_code)
· · ·
111 - type: textarea
112 attributes:
113 ▶ label: Error Message and Stack Trace (if applicable)
114 description: |
115 If you are reporting an error, please copy and paste the full error message and
· · ·
115 ▶ If you are reporting an error, please copy and paste the full error message and
116 stack trace.
117 (This will be automatically formatted into code, so no need for backticks.)
· · ·
122 label: Description
123 description: |
124 ▶ What is the problem, question, or error?
125
126 Write a short description telling what you are doing, what you expect to happen, and what is currently happening.
16
17 - Examples:
18 ▶ - fix(anthropic): resolve flag parsing error
19 - feat(core): add multi-tenant support
20 - test(openai): update API usage tests
236 dirs = [d for d in VCR_PACKAGES if d in all_affected]
237 else:
238 ▶ raise ValueError(f"Unknown job: {job}")
239
240 return [
· · ·
254
255 Raises:
256 ▶ ValueError: If a single argument looks like JSON but is not a string array.
257 """
258 if len(args) != 1:
· · ·
265 try:
266 parsed = json.loads(value)
267 ▶ except json.JSONDecodeError as e:
268 msg = "Expected changed files JSON to be a list of strings."
269 raise ValueError(msg) from e
· · ·
269 ▶ raise ValueError(msg) from e
270
271 if not isinstance(parsed, list) or not all(
· · ·
273 ):
274 msg = "Expected changed files JSON to be a list of strings."
275 ▶ raise ValueError(msg)
276 return parsed
277
+ 1 more matches in this file
42
43 Raises:
44 ▶ ValueError: If the dependency string cannot be parsed.
45 """
46 match = _NAME_RE.match(dep)
· · ·
47 if not match:
48 msg = f"Cannot parse dependency: {dep!r}"
49 ▶ raise ValueError(msg)
50 name = match.group(1)
51 rest = dep[match.end() :].strip()
· · ·
55 if close == -1:
56 msg = f"Unclosed extras bracket in dependency: {dep!r}"
57 ▶ raise ValueError(msg)
58 rest = rest[close + 1 :].strip()
59
· · ·
70
71 def main(pyproject_path: Path) -> int:
72 ▶ """Check extras sync and return `0` on pass, `1` on mismatch or parse error."""
73 with pyproject_path.open("rb") as f:
74 data = tomllib.load(f)
· · ·
78 try:
79 name, spec = _parse_dep(dep)
80 ▶ except ValueError as e:
81 print(f"::error file={pyproject_path}::{e}")
82 return 1
+ 3 more matches in this file
25
26 if "rc" in dep_version_string:
27 ▶ raise ValueError(
28 f"Dependency {dep_version} has a prerelease version. Please remove this."
29 )
· · ·
32 "allow-prereleases", False
33 ):
34 ▶ raise ValueError(
35 f"Dependency {dep_version} has allow-prereleases set to true. Please remove this."
36 )
46 Raises:
47 requests.exceptions.RequestException: If PyPI API request fails
48 ▶ KeyError: If package not found or response format unexpected
49 """
50 pypi_url = f"https://pypi.org/pypi/{package_name}/json"
· · ·
86 if spec_set.contains(version):
87 valid_versions.append(version)
88 ▶ except ValueError:
89 continue
90
· · ·
183 return version in constraints
184 except Exception as e:
185 ▶ print(f"Error: {e}")
186 return False
187
· · ·
205 if unresolved:
206 print(
207 ▶ "ERROR: no published version on PyPI satisfies the declared constraint "
208 f"for: {', '.join(sorted(unresolved))}. A release likely pinned a "
209 "dependency to a version that is not yet published. Release the "
13 raw = fs.readFileSync(configPath, 'utf8');
14 } catch (e) {
15 ▶ throw new Error(`Failed to read ${configPath}: ${e.message}`);
16 }
17 let config;
· · ·
19 config = JSON.parse(raw);
20 } catch (e) {
21 ▶ throw new Error(`Failed to parse pr-labeler-config.json: ${e.message}`);
22 }
23 const required = [
· · ·
28 const missing = required.filter(k => !(k in config));
29 if (missing.length > 0) {
30 ▶ throw new Error(`pr-labeler-config.json missing required keys: ${missing.join(', ')}`);
31 }
32 return config;
· · ·
35 function init(github, owner, repo, config, core) {
36 if (!core) {
37 ▶ throw new Error('init() requires a `core` parameter (e.g., from actions/github-script)');
38 }
39 const {
· · ·
105 test = p => re.test(p);
106 } else {
107 ▶ throw new Error(
108 `fileRules[${i}] (label: "${rule.label}") has no recognized matcher ` +
109 `(expected one of: prefix, suffix, exact, pattern)`
+ 4 more matches in this file
27 # PyYAML (YAML 1.1) parses the bare key `on` as boolean True
28 return data[True]["workflow_dispatch"]["inputs"]["working-directory"]["options"]
29 ▶ except (KeyError, TypeError) as e:
30 msg = f"Could not find workflow_dispatch options in {workflow}: {e}"
31 raise AssertionError(msg) from e
· · ·
31 ▶ raise AssertionError(msg) from e
32
33
67
68 if __name__ != "__main__":
69 ▶ raise ImportError("{} should not be used as a module.".format(__name__))
70
71 import argparse
· · ·
313 try:
314 cwd = os.path.dirname(os.path.realpath(__file__))
315 ▶ return Git(cwd=cwd, errors=False).describe().lstrip("v")
316 except Git.Error:
317 return "-".join((version, "unknown"))
· · ·
316 ▶ except Git.Error:
317 return "-".join((version, "unknown"))
318
· · ·
407
408 class Git:
409 ▶ def __init__(self, workdir=None, gitdir=None, cwd=None, errors=True):
410 self.gitcmd = ["git"]
411 self.errors = errors
· · ·
411 ▶ self.errors = errors
412 self._proc = None
413 if workdir:
+ 20 more matches in this file
1 ▶ # Validates that a package's integration tests compile without syntax or import errors.
2 #
3 # (If an integration test fails to compile, it won't run.)
111 resolved="${GITHUB_WORKSPACE}/${CLI_PATH}"
112 if [ ! -d "${resolved}" ]; then
113 ▶ echo "::error::cli-path '${CLI_PATH}' does not exist at ${resolved}"
114 exit 1
115 fi
· · ·
136 run: |
137 echo "${PROVIDERS_JSON}" | jq -e 'type == "array" and length > 0' > /dev/null || {
138 ▶ echo "::error::providers input must be a non-empty JSON array"
139 exit 1
140 }
· · ·
141 echo "${PROVIDERS_JSON}" | jq -e 'all(has("provider") and has("data_dir"))' > /dev/null || {
142 ▶ echo "::error::every entry in providers must have 'provider' and 'data_dir' keys"
143 exit 1
144 }
· · ·
159 --provider "${provider}" \
160 --data-dir "${GITHUB_WORKSPACE}/${data_dir}"; then
161 ▶ echo "::error::Failed to refresh provider: ${provider}"
162 failed="${failed} ${provider}"
163 fi
· · ·
164 done
165 if [ -n "${failed}" ]; then
166 ▶ echo "::error::The following providers failed:${failed}"
167 exit 1
168 fi
198 import sys
199 import tomllib
200 ▶ import urllib.error
201 import urllib.request
202
· · ·
219 if requested_version and normalize(requested_version) != normalize(version):
220 print(
221 ▶ f"::error::Requested release version {requested_version!r} does "
222 f"not match {pkg_name} pyproject.toml version {version!r}."
223 )
· · ·
233 with urllib.request.urlopen(url, timeout=10):
234 already_published = True
235 ▶ except urllib.error.HTTPError as err:
236 if err.code == 404:
237 already_published = False
· · ·
239 # Fail closed: an unexpected status means we can't verify.
240 print(
241 ▶ f"::error::PyPI returned HTTP {err.code} checking whether "
242 f"{pkg_name}=={version} exists; cannot verify, aborting."
243 )
· · ·
244 sys.exit(1)
245 ▶ except urllib.error.URLError as err:
246 # Fail closed: if PyPI is unreachable we must not assume the version
247 # is free, or we risk re-publishing an existing release.
+ 9 more matches in this file
50 } catch (e) {
51 if (e.status !== 404) {
52 ▶ throw new Error(`getLabel(${labelName}) failed: ${e.message}`);
53 }
54 try {
· · ·
63 const alreadyExists =
64 createErr.status === 422 &&
65 ▶ Array.isArray(createErr.errors) &&
66 createErr.errors.some(e => e.code === 'already_exists');
67 if (!alreadyExists) throw createErr;
· · ·
66 ▶ createErr.errors.some(e => e.code === 'already_exists');
67 if (!alreadyExists) throw createErr;
68 }
48 semver='^[0-9]+\.[0-9]+\.[0-9]+$'
49 if [[ ! "$current" =~ $semver ]]; then
50 ▶ echo "::error::Could not parse current uv pin from $action_file (got '$current')"
51 exit 1
52 fi
· · ·
53 if [[ ! "$latest" =~ $semver ]]; then
54 ▶ echo "::error::Unexpected uv tag from GitHub API (got '$latest')"
55 exit 1
56 fi
· · ·
139 action_file=".github/actions/uv_setup/action.yml"
140
141 ▶ # `grep -c` returns 1 on no-match and 2 on read errors. We want
142 # "no match" surfaced as the explicit count-of-zero check below;
143 # read errors must abort. Capture the exit code separately so
· · ·
143 ▶ # read errors must abort. Capture the exit code separately so
144 # `set -e` doesn't swallow either case.
145 set +e
· · ·
148 set -e
149 if [ "$before_rc" -gt 1 ]; then
150 ▶ echo "::error::grep read error on $action_file (exit=$before_rc)"
151 exit 1
152 fi
+ 3 more matches in this file
58 )
59 if [ ${#files[@]} -eq 0 ]; then
60 ▶ echo "::error::No pyproject.toml files found under libs/"
61 exit 1
62 fi
· · ·
68 done
69 if [ ${#failed[@]} -gt 0 ]; then
70 ▶ echo "::error::Extras-sync check failed for ${#failed[@]} package(s):"
71 printf '::error:: %s\n' "${failed[@]}"
72 exit 1
· · ·
71 ▶ printf '::error:: %s\n' "${failed[@]}"
72 exit 1
73 fi
126 # New manifest: absent at the base ref, so not a version bump.
127 continue
128 ▶ print(f"::error file={manifest}::failed to read base manifest: {stderr}")
129 sys.exit(1)
130 base = project_table(shown.stdout)
· · ·
189 project = data.get("project")
190 if project is None:
191 ▶ print(f"::error file={manifest_path}::no [project] table to resolve")
192 sys.exit(1)
193
· · ·
243 else
244 # Surface the resolver's reason (stdout+stderr were captured) and tell a
245 ▶ # likely-transient index/network error apart from a genuinely bad pin.
246 cat "$filtered_dir/compile.log"
247 if grep -qiE 'error sending request|failed to fetch|error trying to connect|connection|timed out|temporarily unavailable|status code (429|50[0-9])' "$filtered_dir/compile.log"; then
· · ·
247 ▶ if grep -qiE 'error sending request|failed to fetch|error trying to connect|connection|timed out|temporarily unavailable|status code (429|50[0-9])' "$filtered_dir/compile.log"; then
248 echo "❌ ${pkg_dir}: resolver hit a possible transient PyPI/index error"
249 transient=1
· · ·
248 ▶ echo "❌ ${pkg_dir}: resolver hit a possible transient PyPI/index error"
249 transient=1
250 else
+ 2 more matches in this file
44 # in sync with pyproject.toml. Don't let it pass unchecked.
45 echo "--- $dir ---"
46 ▶ echo "Error: $dir has a _version.py but no 'check_version' Makefile target"
47 FAILED=1
48 fi
67 run: |
68 if [ -z "${{ steps.app-token.outputs.token }}" ]; then
69 ▶ echo "::error::GitHub App token generation failed — cannot classify contributor"
70 exit 1
71 fi
9 # Examples:
10 # feat(core): add multi‐tenant support
11 ▶ # fix(langchain): resolve error
12 # docs: update API usage examples
13 # docs(openai): update API usage examples
· · ·
72 run: |
73 if [[ "$PR_TITLE" =~ ^[a-z]+\(\)[!]?: ]]; then
74 ▶ echo "::error::PR title has empty scope parentheses: '$PR_TITLE'"
75 echo "Either remove the parentheses or provide a scope (e.g., 'fix(core): ...')."
76 exit 1
71 // Comment write paths can fail for several reasons that should not
72 // turn this advisory job red on its own: fork PRs run with
73 ▶ // restricted tokens, secondary rate limits, transient API errors.
74 // Fall back to `core.summary` so a maintainer can paste the
75 // remediation manually. The check still fails — `setFailed` is
· · ·
99 }
100 } catch (commentErr) {
101 ▶ core.warning(`Could not post sticky comment (fork PR token, rate limit, or transient API error): ${commentErr.message}`);
102 await core.summary
103 .addHeading(summaryHeading)
54 }));
55 } catch (e) {
56 ▶ throw new Error(
57 `Failed to search for closed PRs to reopen after assigning ${assignee} ` +
58 `to #${issueNumber} (HTTP ${e.status ?? 'unknown'}): ${e.message}`,
· · ·
121 continue;
122 }
123 ▶ // Transient errors (rate limit, 5xx) should fail the job so
124 // the label is NOT removed and the run can be retried.
125 throw e;
87 const sender = context.payload.sender?.login;
88 if (!sender) {
89 ▶ throw new Error('Event has no sender — cannot check permissions');
90 }
91 try {
· · ·
106 }
107 const status = e.status ?? 'unknown';
108 ▶ throw new Error(
109 `Permission check failed for ${sender} (HTTP ${status}): ${e.message}`,
110 );
· · ·
265 console.log(`PR author "${prAuthor}" is NOT assigned to #${num} (assignees: ${assignees.join(', ') || 'none'})`);
266 }
267 ▶ } catch (error) {
268 if (error.status === 404) {
269 console.log(`Issue #${num} not found — skipping`);
· · ·
268 ▶ if (error.status === 404) {
269 console.log(`Issue #${num} not found — skipping`);
270 } else {
· · ·
271 ▶ // Non-404 errors (rate limit, server error) must not be
272 // silently skipped — they could cause false enforcement
273 // (closing a legitimate PR whose assignment can't be verified).
+ 4 more matches in this file
201 - [ ] Tests fail when your new logic is broken
202 - [ ] Happy path is covered
203 ▶ - [ ] Edge cases and error conditions are tested
204 - [ ] Use fixtures/mocks for external dependencies
205 - [ ] Tests are deterministic (no flaky tests)
· · ·
209
210 - No `eval()`, `exec()`, or `pickle` on user-controlled input
211 ▶ - Proper exception handling (no bare `except:`) and use a `msg` variable for error messages
212 - Remove unreachable/commented code before committing
213 - Race conditions or resource leaks (file handles, sockets, threads).
· · ·
233
234 Raises:
235 ▶ InvalidEmailError: If the email address format is invalid.
236 SMTPConnectionError: If unable to connect to email server.
237 """
· · ·
236 ▶ SMTPConnectionError: If unable to connect to email server.
237 """
238 ```
201 - [ ] Tests fail when your new logic is broken
202 - [ ] Happy path is covered
203 ▶ - [ ] Edge cases and error conditions are tested
204 - [ ] Use fixtures/mocks for external dependencies
205 - [ ] Tests are deterministic (no flaky tests)
· · ·
209
210 - No `eval()`, `exec()`, or `pickle` on user-controlled input
211 ▶ - Proper exception handling (no bare `except:`) and use a `msg` variable for error messages
212 - Remove unreachable/commented code before committing
213 - Race conditions or resource leaks (file handles, sockets, threads).
· · ·
233
234 Raises:
235 ▶ InvalidEmailError: If the email address format is invalid.
236 SMTPConnectionError: If unable to connect to email server.
237 """
· · ·
236 ▶ SMTPConnectionError: If unable to connect to email server.
237 """
238 ```
71
72 Raises:
73 ▶ AttributeError: If the attribute is not a valid dynamic import.
74 """
75 module_name = _dynamic_imports.get(attr_name)
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter
Search any public repo from your terminal
This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.