Fix gcloud Run Deploy Command Errors | Generated by AI

Home 2026.02

Question: Why does the gcloud run deploy command with –source . give “unrecognized arguments” error, and how to fix it for deploying blog-server to Cloud Run?

Answer:

The error occurs because the shell (zsh in your case) is interpreting the flags after the first line break as separate commands instead of arguments to gcloud.

When you paste multi-line commands like this into the terminal:

gcloud run deploy blog-server \
  --source . \
  --region asia-northeast1 \
  --allow-unauthenticated \
  --port 8080 \
  --memory 1Gi

zsh treats each line after the backslash as a new command if the continuation isn’t handled correctly (common when copying from formatted text/markdown where line breaks are added).

This results in:

The actual “unrecognized arguments” from gcloud likely comes from an incomplete/invalid invocation.

How to fix it

Option 1: Run it as a single line (easiest and most reliable)

gcloud run deploy blog-server --source . --region asia-northeast1 --allow-unauthenticated --port 8080 --memory 1Gi

Option 2: Use proper line continuation in your terminal

Paste or type it like this (ensure no extra spaces after \):

gcloud run deploy blog-server \
    --source . \
    --region asia-northeast1 \
    --allow-unauthenticated \
    --port 8080 \
    --memory 1Gi

Option 3: Put it in a shell script

Create a file (e.g. deploy.sh):

#!/bin/bash
gcloud run deploy blog-server \
  --source . \
  --region asia-northeast1 \
  --allow-unauthenticated \
  --port 8080 \
  --memory 1Gi

Then run:

chmod +x deploy.sh
./deploy.sh

Additional notes (as of February 2026)

After successful deploy, you’ll see a service URL like https://blog-server-XXXXXX.a.run.app.

References:


Back Donate