Skip to content

How can I diagnose a Runtime.invalidEntrypoint after looking at the documented steps

0

I have read https://repost.aws/knowledge-center/lambda-docker-image-error.

My image is the correct (amd64) architecture.

My container definition starts with: FROM public.ecr.aws/lambda/python:3.12, so it is not my job to specify ENTRYPOINT.

My lambda runs fine when I follow the instructions to run it with 'docker run' and poke it with 'curl'.

When deployed on AWS, invocations with 'aws lambda invoke' return:

{"errorType":"Runtime.InvalidEntrypoint","errorMessage":"RequestId: 4cce2a1c-38c5-40bb-bd76-dc01863c68b7 Error: exec: no command"}

The only error we get in cloudwatch is:

{
    "time": "2025-06-10T20:40:57.202Z",
    "type": "platform.report",
    "record": {
        "requestId": "535e494d-a5cb-42a4-905e-77171d2d1549",
        "metrics": {
            "durationMs": 1.656,
            "billedDurationMs": 2,
            "memorySizeMB": 512,
            "maxMemoryUsedMB": 3
        },
        "status": "error",
        "errorType": "Runtime.InvalidEntrypoint"
    }
}

Searching the internet for 'exec: no command' yields nothing of relevance.

asked 10 months ago172 views
2 Answers
-1

To diagnose a Runtime.InvalidEntrypoint error in your Lambda function using a container image, I recommend checking the following:

  1. Verify that your ENTRYPOINT in the Dockerfile includes the absolute path as the location. The error often occurs when the ENTRYPOINT is not properly specified or contains a symlink.

  2. If you're using an AWS CloudFormation template, check if your container ENTRYPOINT is being overridden with a null or empty value. If you declare an ImageConfig resource in your template, you must provide non-empty values for all three properties.

  3. For Python Lambda container images, ensure you have the correct ENTRYPOINT configuration. The base image from public.ecr.aws/lambda/python:3.12 should already have the proper ENTRYPOINT set up, but if you've modified it, that could cause issues.

  4. Check your Dockerfile to ensure it includes both ENTRYPOINT and CMD directives. For Python Lambda functions, a typical configuration would be:

  • ENTRYPOINT pointing to the Lambda runtime interface client
  • CMD specifying your handler function (e.g., ["lambda_function.handler"])
  1. If you're building a custom runtime, ensure that the bootstrap file exists and is executable. Lambda looks for this file at the root of your deployment package or in the function's layers.

  2. Review your CloudWatch logs for additional error messages beyond the Runtime.InvalidEntrypoint error you shared, as there might be more detailed information about what's causing the issue.

  3. If the image works locally but fails in Lambda, double-check that your local testing environment matches how Lambda would invoke the container.

Since the error is occurring despite the image working locally with 'docker run', the issue might be related to how Lambda is trying to invoke your function rather than the image architecture itself.
Sources
Troubleshoot invocation issues in Lambda - AWS Lambda
AWS Lambda: Runtime.InvalidEntrypoint | AWS re:Post
Building a custom runtime for AWS Lambda - AWS Lambda

answered 10 months ago
EXPERT
reviewed 10 months ago
  • I've looked at all of these things already.

-1

As mentioned by repost agent, you need to define the entry point correctly. Here's an example.

FROM public.ecr.aws/lambda/python:3.12

# Copy function code
COPY app.py .  # or your appropriate module

# Install dependencies (if any)
# RUN pip install -r requirements.txt

# Set handler
CMD ["app.lambda_handler"]

Assuming the handler is defined in app.py, make sure this file is in the root of the files.

Do NOT use: CMD ["python", "app.py"] - Lambda function won't work like that.

EXPERT
answered 10 months ago
EXPERT
reviewed 10 months ago
  • Why would you assume that I have not followed the instructions for defining CMD? I have indeed followed them, and have a package.package.function_name as my CMD.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.