Courseiva
Deployment →easyMultiple Choice

DVA-C02 Deployment Practice Question

A developer is using AWS CodeBuild to compile and test code. The build phase fails with the error: 'BUILD_FAILED: Error: No such file or directory.' What is the most likely cause?

⚠ Common exam trap

The trap is attributing a file-not-found error to permissions or environment variables, when the literal error message points to a missing path in the source or buildspec.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

The buildspec.yml file references a file or directory that does not exist in the source code.

The error 'No such file or directory' during the build phase almost always means a command in buildspec.yml (or a referenced script/artifact path) points to a file that is not present in the checked-out source. CodeBuild runs each phase command in the container's working directory, so a typo or missing file in the repo produces exactly this error.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    The build environment has a network timeout when accessing external dependencies.

    Why it's wrong here

    If the CodeBuild environment encountered a network timeout while attempting to access external dependencies, the resulting error message would typically indicate a connection issue, such as 'Connection timed out', 'Host unreachable', or 'DNS resolution failed'. This type of error occurs when the build process cannot establish or maintain a network connection to fetch packages or resources from external repositories. It would not manifest as a 'No such file or directory' error, which specifically points to a local file system lookup failure.

  • ✓

    The buildspec.yml file references a file or directory that does not exist in the source code.

    Why this is correct

    When CodeBuild executes commands defined within the `buildspec.yml` file, and those commands reference a file or directory path that does not exist within the cloned source code repository, the operating system returns a 'No such file or directory' error. This indicates that a specific path, perhaps for a script, configuration file, or source artifact expected by the build process, cannot be located at the specified position. It's a common issue arising from incorrect paths in the buildspec, missing files in the source control, or incorrect working directories.

  • ✗

    The IAM role for CodeBuild does not have permissions to access the source repository.

    Why it's wrong here

    An insufficient IAM role for CodeBuild to access the source repository would lead to authentication or authorization failures during the initial source download phase of the build. Error messages would typically include phrases like 'Access Denied', 'Authentication failed', or 'Unauthorized', preventing the build from even starting or cloning the repository. This issue would occur before any commands in the `buildspec.yml` could be executed, thus not resulting in a 'No such file or directory' error related to local file access.

  • ✗

    The build environment does not have the required environment variables set.

    Why it's wrong here

    If the CodeBuild environment lacks required environment variables, any script or application attempting to use those variables would typically produce errors such as 'Undefined variable', 'Variable not set', or a similar message indicating a missing value. The build process would not interpret the absence of an environment variable as a non-existent file path. Environment variable issues are distinct from file system lookup failures, which specifically relate to the physical presence of files or directories.

About these practice questions

This DVA-C02 question is part of Courseiva's 1,135-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.