micro/go-micro · error

image generation failed: %s

Error message

image generation failed: %s

What it means

Thrown by pollPrediction when the Atlas Cloud poll endpoint reports the image job's status as "failed". The provider surfaces the job-level Error string from the API response. This means the submission succeeded but the generation itself failed server-side.

Source

Thrown at ai/atlascloud/atlascloud.go:1038

		Data struct {
			Status  string   `json:"status"`
			Outputs []string `json:"outputs"`
			Error   string   `json:"error"`
		} `json:"data"`
	}
	if err := json.Unmarshal(body, &pollResp); err != nil {
		return nil, fmt.Errorf("failed to parse poll response: %w", err)
	}

	switch pollResp.Data.Status {
	case "completed":
		resp := &ai.ImageResponse{}
		for _, output := range pollResp.Data.Outputs {
			resp.Images = append(resp.Images, ai.Image{URL: output})
		}
		return resp, nil
	case "failed":
		return nil, fmt.Errorf("image generation failed: %s", pollResp.Data.Error)
	default:
		return nil, nil
	}
}

const defaultVideoModel = "google/gemini-omni-flash/image-to-video-developer"

// GenerateVideo creates a video using Atlas Cloud's async video API.
// Supports text-to-video and image-to-video depending on whether
// Images are provided in the request.
func (p *Provider) GenerateVideo(ctx context.Context, req *ai.VideoRequest, opts ...ai.GenerateOption) (*ai.VideoResponse, error) {
	model := req.Model
	if model == "" {
		model = defaultVideoModel
	}
	duration := req.Duration
	if duration <= 0 {
		duration = 6

View on GitHub (pinned to 24529f1404)

Solutions

  1. Read the embedded pollResp.Data.Error message in the error text — it states the server-side reason
  2. Verify the model slug passed in req.Model exists and is enabled for your Atlas Cloud account
  3. Adjust the prompt if the error indicates a content-policy violation
  4. Retry with a different model or simplified parameters to rule out transient capacity issues
  5. Check your Atlas Cloud account quota/credits if the error references billing

Example fix

// before
case "failed":
	return nil, fmt.Errorf("image generation failed: %s", pollResp.Data.Error)
// after: make the model/job identifiable for debugging
case "failed":
	return nil, fmt.Errorf("image generation failed (job %s, model %s): %s", jobID, model, pollResp.Data.Error)
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate inputs the provider commonly rejects
if prompt == "" || len(prompt) > 4000 {
	return fmt.Errorf("prompt empty or too long")
}
if model != "" && !supportedModels[model] {
	return fmt.Errorf("unsupported model %q", model)
}

Type guard

func isGenerationFailedErr(err error) (string, bool) {
	msg := err.Error()
	if strings.HasPrefix(msg, "image generation failed:") {
		return strings.TrimPrefix(msg, "image generation failed: "), true
	}
	return "", false
}

Try / catch

resp, err := provider.GenerateImage(ctx, req)
if err != nil {
	if reason, ok := isGenerationFailedErr(err); ok {
		log.Printf("provider rejected generation: %s — adjusting prompt/model", reason)
		return fallbackModel(ctx, req)
	}
	return err
}

Prevention

When it happens

Trigger: GenerateImage submits a job, polling continues until status=="failed"; pollResp.Data.Error from the API is embedded into the message. Typically caused by an invalid/unsupported model name, a rejected prompt (content policy), or invalid image inputs.

Common situations: Using a model slug that no longer exists on Atlas Cloud; prompts violating the provider's content policy; requesting unsupported dimensions/parameters; provider-side capacity failures; expired model deprecations after an API update.

Related errors


AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01). Data as JSON: /api/errors/ab62a223cbde8696. Report an issue: GitHub.