Engineering Tools for AI

Lập trình

Hướng dẫn đọc lỗi

Hướng dẫn thực tế để tìm dòng nguyên nhân, đường dẫn file, cảnh báo và lỗi thật trong log.

31 mục

Cấu trúc thông báo

First error line

First error line

TypeError: Cannot read properties of undefined

Ý nghĩa

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

Cách đọc

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

Ví dụ

TypeError: Cannot read properties of undefined

Ví dụ yêu cầu

Find the first real error line in this log.

Cấu trúc thông báo

Error name

Error name

SyntaxError, TypeError, ReferenceError

Ý nghĩa

The error name tells you the broad class of problem.

Cách đọc

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

Ví dụ

SyntaxError, TypeError, ReferenceError

Ví dụ yêu cầu

Classify this error by error name before suggesting a fix.

Cấu trúc thông báo

Error message

Error message

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

Ý nghĩa

The message explains what the tool could not do.

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

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

Cấu trúc thông báo

Stack trace

Stack trace

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

Ý nghĩa

A list of function calls that led to the error.

Cách đọc

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

Lưu ý

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

Ví dụ

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

Ví dụ yêu cầu

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

Gợi ý vị trí

File path

File path

src/components/LanguageSwitcher.tsx

Ý nghĩa

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

Cách đọc

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

Ví dụ

src/components/LanguageSwitcher.tsx

Ví dụ yêu cầu

List the project files mentioned by this error.

Gợi ý vị trí

Line and column

Line and column

src/app/page.tsx:27:12

Ý nghĩa

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

Cách đọc

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

Ví dụ

src/app/page.tsx:27:12

Ví dụ yêu cầu

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

Gợi ý vị trí

Project file line

Project file line

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Separate my project file lines from framework lines.

Gợi ý vị trí

node_modules line

node_modules line

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

Ý nghĩa

A line inside an installed dependency or framework package.

Cách đọc

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

Lưu ý

Do not edit node_modules as a normal fix.

Ví dụ

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

Ví dụ yêu cầu

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

Lỗi runtime JavaScript

SyntaxError

SyntaxError

SyntaxError: Unexpected token '}'

Ý nghĩa

JavaScript or TypeScript could not parse the code.

Cách đọc

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

Ví dụ

SyntaxError: Unexpected token '}'

Ví dụ yêu cầu

Find the syntax problem around this line.

Lỗi runtime JavaScript

TypeError

TypeError

TypeError: Cannot read properties of undefined

Ý nghĩa

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

Cách đọc

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

Ví dụ

TypeError: Cannot read properties of undefined

Ví dụ yêu cầu

Trace where this undefined value comes from.

Lỗi runtime JavaScript

ReferenceError

ReferenceError

ReferenceError: copy is not defined

Ý nghĩa

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

Cách đọc

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

Ví dụ

ReferenceError: copy is not defined

Ví dụ yêu cầu

Find why this name is not defined.

Lỗi runtime JavaScript

Cannot read properties of undefined

Cannot read properties of undefined

Cannot read properties of undefined (reading 'navLabel')

Ý nghĩa

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

Cách đọc

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

Ví dụ

Cannot read properties of undefined (reading 'navLabel')

Ví dụ yêu cầu

Identify which value is undefined in this error.

Lỗi runtime JavaScript

is not a function

is not a function

setOpenMenu is not a function

Ý nghĩa

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

Cách đọc

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

Ví dụ

setOpenMenu is not a function

Ví dụ yêu cầu

Find why this value is being called as a function.

Next.js và web

Module not found

Module not found

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Check the import path and the actual file path.

Next.js và web

Export not found

Export not found

Export errorMessageGuideCopy doesn't exist in target module

Ý nghĩa

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

Cách đọc

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

Ví dụ

Export errorMessageGuideCopy doesn't exist in target module

Ví dụ yêu cầu

Find the mismatched import or export name.

Next.js và web

Hydration failed

Hydration failed

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Find the likely server and client render mismatch.

Next.js và web

404 Not Found

404 Not Found

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

Ý nghĩa

The requested route or file could not be found.

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Check why this route returns 404.

Next.js và web

500 Internal Server Error

500 Internal Server Error

GET /ko 500

Ý nghĩa

The server received the request but failed while processing it.

Cách đọc

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

Ví dụ

GET /ko 500

Ví dụ yêu cầu

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

TypeScript và lint

Property does not exist on type

Property does not exist on type

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Explain why TypeScript thinks this property does not exist.

TypeScript và lint

Type is not assignable

Type is not assignable

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Show the actual type and expected type in this error.

TypeScript và lint

ESLint error

ESLint error

React Hook useEffect has a missing dependency

Ý nghĩa

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

Cách đọc

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

Ví dụ

React Hook useEffect has a missing dependency

Ví dụ yêu cầu

Explain this lint error and fix it without changing behavior.

Next.js và web

Build failed

Build failed

Failed to compile.

Ý nghĩa

The production build could not finish.

Cách đọc

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

Ví dụ

Failed to compile.

Ví dụ yêu cầu

From this build log, identify the first blocking failure.

Terminal và hệ thống

EADDRINUSE

EADDRINUSE

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

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

Terminal và hệ thống

ENOENT

ENOENT

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

Ý nghĩa

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

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

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

Terminal và hệ thống

Permission denied

Permission denied

Operation not permitted

Ý nghĩa

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

Cách đọc

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

Lưu ý

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

Ví dụ

Operation not permitted

Ví dụ yêu cầu

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

Terminal và hệ thống

Command not found

Command not found

zsh: command not found: next

Ý nghĩa

The shell cannot find an executable command with that name.

Cách đọc

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

Ví dụ

zsh: command not found: next

Ví dụ yêu cầu

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

Thứ tự gỡ lỗi

Warning

Warning

DeprecationWarning: module.register() is deprecated

Ý nghĩa

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

Cách đọc

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

Ví dụ

DeprecationWarning: module.register() is deprecated

Ví dụ yêu cầu

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

Thứ tự gỡ lỗi

DeprecationWarning

DeprecationWarning

DeprecationWarning: module.register() is deprecated

Ý nghĩa

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

Cách đọc

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

Ví dụ

DeprecationWarning: module.register() is deprecated

Ví dụ yêu cầu

Tell me whether this DeprecationWarning blocks deployment.

Thứ tự gỡ lỗi

Recent change

Recent change

The error started after editing SiteHeader.tsx

Ý nghĩa

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

Cách đọc

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

Ví dụ

The error started after editing SiteHeader.tsx

Ví dụ yêu cầu

Compare this error with the files changed most recently.

Thứ tự gỡ lỗi

Reproduce step

Reproduce step

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

Ý nghĩa

The smallest action sequence that makes the error appear again.

Cách đọc

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

Ví dụ

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

Ví dụ yêu cầu

Turn this description into exact reproduce steps.

Thứ tự gỡ lỗi

Minimal log

Minimal log

Error line + file path + stack line from src

Ý nghĩa

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

Cách đọc

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

Ví dụ

Error line + file path + stack line from src

Ví dụ yêu cầu

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