Engineering Tools for AI

编程

错误消息阅读指南

学习从错误日志找出真正原因、文件位置、警告与失败差异,并提出准确的调试请求。

31 个项目

消息结构

First error line

First error line

TypeError: Cannot read properties of undefined

含义

The first clear error line is often the best starting point.

阅读方式

Ignore repeated follow-up logs at first and identify the first line that names the failure.

示例

TypeError: Cannot read properties of undefined

请求示例

Find the first real error line in this log.

消息结构

Error name

Error name

SyntaxError, TypeError, ReferenceError

含义

The error name tells you the broad class of problem.

阅读方式

Use it to separate syntax, runtime, type, network, and environment problems.

示例

SyntaxError, TypeError, ReferenceError

请求示例

Classify this error by error name before suggesting a fix.

消息结构

Error message

Error message

Module not found: Can't resolve '@/lib/error-message-guide'

含义

The message explains what the tool could not do.

阅读方式

Read the verb and object: could not resolve a module, could not read a property, or could not bind a port.

示例

Module not found: Can't resolve '@/lib/error-message-guide'

请求示例

Rewrite this error message in plain Korean and point to the likely cause.

消息结构

Stack trace

Stack trace

at SiteHeader (src/components/SiteHeader.tsx:42:15)

含义

A list of function calls that led to the error.

阅读方式

Find the first line that points to your project file, then inspect that area.

注意

The top stack line is not always your code. Some lines are framework internals.

示例

at SiteHeader (src/components/SiteHeader.tsx:42:15)

请求示例

In this stack trace, identify the first line from my project.

位置线索

File path

File path

src/components/LanguageSwitcher.tsx

含义

The path tells you which file the tool thinks is involved.

阅读方式

Prefer paths under src, app, components, or lib before inspecting dependency folders.

示例

src/components/LanguageSwitcher.tsx

请求示例

List the project files mentioned by this error.

位置线索

Line and column

Line and column

src/app/page.tsx:27:12

含义

Line and column narrow the location to a specific character area.

阅读方式

Inspect the named line plus a few lines above it, because the real cause can start earlier.

示例

src/app/page.tsx:27:12

请求示例

Open the file around the reported line and explain what looks wrong.

位置线索

Project file line

Project file line

src/lib/git-github.ts:143:7

含义

A stack or build line that points to your source code instead of a dependency.

阅读方式

This is usually the line to inspect before reading long framework traces.

示例

src/lib/git-github.ts:143:7

请求示例

Separate my project file lines from framework lines.

位置线索

node_modules line

node_modules line

node_modules/next/dist/server/app-render.js

含义

A line inside an installed dependency or framework package.

阅读方式

Treat it as context unless the log also points to a package version or configuration problem.

注意

Do not edit node_modules as a normal fix.

示例

node_modules/next/dist/server/app-render.js

请求示例

Tell me whether this node_modules line is the cause or just context.

JavaScript 运行错误

SyntaxError

SyntaxError

SyntaxError: Unexpected token '}'

含义

JavaScript or TypeScript could not parse the code.

阅读方式

Check brackets, quotes, commas, JSX tags, and incomplete expressions near the reported line.

示例

SyntaxError: Unexpected token '}'

请求示例

Find the syntax problem around this line.

JavaScript 运行错误

TypeError

TypeError

TypeError: Cannot read properties of undefined

含义

A value did not have the shape or behavior the code expected at runtime.

阅读方式

Check whether the value can be undefined, null, a string instead of an object, or a missing function.

示例

TypeError: Cannot read properties of undefined

请求示例

Trace where this undefined value comes from.

JavaScript 运行错误

ReferenceError

ReferenceError

ReferenceError: copy is not defined

含义

The code tried to use a variable or function name that is not available in that scope.

阅读方式

Check imports, spelling, scope, and whether the variable is declared before use.

示例

ReferenceError: copy is not defined

请求示例

Find why this name is not defined.

JavaScript 运行错误

Cannot read properties of undefined

Cannot read properties of undefined

Cannot read properties of undefined (reading 'navLabel')

含义

The code tried to access a property on a value that is undefined.

阅读方式

Check the object before the dot, such as copy, locale, params, or a map lookup result.

示例

Cannot read properties of undefined (reading 'navLabel')

请求示例

Identify which value is undefined in this error.

JavaScript 运行错误

is not a function

is not a function

setOpenMenu is not a function

含义

The code tried to call something with parentheses, but the value is not a function.

阅读方式

Check whether a prop, import, hook result, or object method has the expected name.

示例

setOpenMenu is not a function

请求示例

Find why this value is being called as a function.

Next.js 与 Web

Module not found

Module not found

Module not found: Can't resolve '@/lib/error-message-guide'

含义

The bundler could not find the file or package named in an import.

阅读方式

Check the file exists, the path spelling is exact, and the alias points to the expected folder.

示例

Module not found: Can't resolve '@/lib/error-message-guide'

请求示例

Check the import path and the actual file path.

Next.js 与 Web

Export not found

Export not found

Export errorMessageGuideCopy doesn't exist in target module

含义

The import name does not match any export from the target file.

阅读方式

Compare the imported name with the exact exported const, function, or type name.

示例

Export errorMessageGuideCopy doesn't exist in target module

请求示例

Find the mismatched import or export name.

Next.js 与 Web

Hydration failed

Hydration failed

Hydration failed because the server rendered HTML didn't match the client

含义

The HTML generated on the server did not match what React rendered in the browser.

阅读方式

Check browser-only values, dates, random values, localStorage, and theme state used during initial render.

示例

Hydration failed because the server rendered HTML didn't match the client

请求示例

Find the likely server and client render mismatch.

Next.js 与 Web

404 Not Found

404 Not Found

GET /ko/reference/error-message-guide 404

含义

The requested route or file could not be found.

阅读方式

Check the route folder, generateStaticParams, link href, and exported static output path.

示例

GET /ko/reference/error-message-guide 404

请求示例

Check why this route returns 404.

Next.js 与 Web

500 Internal Server Error

500 Internal Server Error

GET /ko 500

含义

The server received the request but failed while processing it.

阅读方式

Look at the terminal log from the same request, not only the browser status code.

示例

GET /ko 500

请求示例

Match this browser 500 with the terminal error that caused it.

TypeScript 与 lint

Property does not exist on type

Property does not exist on type

Property 'navLabel' does not exist on type 'string'

含义

TypeScript says the value's declared type does not include that property.

阅读方式

Check whether the value has the correct type, whether it was indexed correctly, and whether the data shape changed.

示例

Property 'navLabel' does not exist on type 'string'

请求示例

Explain why TypeScript thinks this property does not exist.

TypeScript 与 lint

Type is not assignable

Type is not assignable

Type 'string' is not assignable to type 'Locale'

含义

A value is being passed somewhere that expects a different type.

阅读方式

Compare the actual value type with the expected type named after 'to type'.

示例

Type 'string' is not assignable to type 'Locale'

请求示例

Show the actual type and expected type in this error.

TypeScript 与 lint

ESLint error

ESLint error

React Hook useEffect has a missing dependency

含义

A static analysis rule found code that may be unsafe, inconsistent, or against project style.

阅读方式

Read the rule name and the file line, then decide whether the code or dependency list should change.

示例

React Hook useEffect has a missing dependency

请求示例

Explain this lint error and fix it without changing behavior.

Next.js 与 Web

Build failed

Build failed

Failed to compile.

含义

The production build could not finish.

阅读方式

Scroll above the summary and find the first compile, type, lint, or route error.

示例

Failed to compile.

请求示例

From this build log, identify the first blocking failure.

终端与系统

EADDRINUSE

EADDRINUSE

Error: listen EADDRINUSE: address already in use :::3001

含义

The server tried to use a port that another process is already using.

阅读方式

Stop the old server or run the new server on a different port.

示例

Error: listen EADDRINUSE: address already in use :::3001

请求示例

Find what is using this port and suggest the safest next step.

终端与系统

ENOENT

ENOENT

ENOENT: no such file or directory, open 'next.config.js'

含义

The process tried to open a file or folder that does not exist at that path.

阅读方式

Check the current working directory, filename spelling, extension, and generated files.

示例

ENOENT: no such file or directory, open 'next.config.js'

请求示例

Check whether this file is missing or the command is running from the wrong folder.

终端与系统

Permission denied

Permission denied

Operation not permitted

含义

The process does not have permission to read, write, or execute the target.

阅读方式

Check sandbox rules, file permissions, protected folders, and whether approval is needed.

注意

Do not fix permission errors by broadly changing permissions unless you understand the target.

示例

Operation not permitted

请求示例

Explain why this permission error happened and what approval is needed.

终端与系统

Command not found

Command not found

zsh: command not found: next

含义

The shell cannot find an executable command with that name.

阅读方式

Check whether dependencies are installed, whether npm scripts should be used, and whether PATH is set.

示例

zsh: command not found: next

请求示例

Tell me whether I should run an npm script instead of this command.

调试顺序

Warning

Warning

DeprecationWarning: module.register() is deprecated

含义

A warning says something may need attention, but it may not stop the current command.

阅读方式

Check whether the command still completed successfully before treating the warning as a failure.

示例

DeprecationWarning: module.register() is deprecated

请求示例

Separate blocking errors from non-blocking warnings in this output.

调试顺序

DeprecationWarning

DeprecationWarning

DeprecationWarning: module.register() is deprecated

含义

A feature still works now but is planned to be replaced or removed later.

阅读方式

If build passes, record it as a follow-up unless it points to your code or a required upgrade.

示例

DeprecationWarning: module.register() is deprecated

请求示例

Tell me whether this DeprecationWarning blocks deployment.

调试顺序

Recent change

Recent change

The error started after editing SiteHeader.tsx

含义

The most recent related edit is often the highest-value clue.

阅读方式

Compare the error location with files modified in the current task.

示例

The error started after editing SiteHeader.tsx

请求示例

Compare this error with the files changed most recently.

调试顺序

Reproduce step

Reproduce step

Open /ko, click the language menu, then click the site menu

含义

The smallest action sequence that makes the error appear again.

阅读方式

Clear reproduce steps make it possible to verify that the fix actually works.

示例

Open /ko, click the language menu, then click the site menu

请求示例

Turn this description into exact reproduce steps.

调试顺序

Minimal log

Minimal log

Error line + file path + stack line from src

含义

A short set of log lines that preserves the actual failure and location.

阅读方式

Keep the first error, the project file path, the command, and the final success or failure summary.

示例

Error line + file path + stack line from src

请求示例

Compress this long log into the minimal lines needed for debugging.