GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OPERATION_INCOMPLETE when on create - delete - create VM · Issue #926 · googleapis/google-cloud-node

OPERATION_INCOMPLETE when on create - delete - create VM #926

New issue
Copy link
New issue
Copy link
Closed
Closed
OPERATION_INCOMPLETE when on create - delete - create VM#926
Copy link
Assignees
stephenplusplus
Labels
api: computeIssues related to the Compute Engine API.type: questionRequest for information or clarification. Not an issue.

Description

@gabipetrovay
gabipetrovay
opened on Nov 9, 2015
Issue body actions

There seems to be an issue with the VM instances when recycling the names. In the below example I create, delete and create again an instance using the same name. The error is shown in the output snippet below.

var BUILDER_MACHINE_NAME = "image2";                                                                          
var BUILDER_MACHINE_CONFIG = {                                                                                
    os: "ubuntu",                                                                                             
    machineType: "g1-small"                                                                                   
};                                                                                                            

var gce = gcloud.compute();                                                                                   
var zone = gce.zone(zone);                                                                                    

zone.createVM(BUILDER_MACHINE_NAME, BUILDER_MACHINE_CONFIG, function(err, vm, operation, apiResponse) {       

    if (err) { return callback(err); }                                                                        

    console.dir(apiResponse);                                                                                 
    console.log("1 --------------");                                                                          

    operation.onComplete(function(err, metadata) {                                                            

        if (err) { return callback(err); }                                                                    

        console.dir(metadata);                                                                                
        console.log("2 --------------");                                                                      

        vm.delete(function(err, operation, apiResponse) {                                                     

            if (err) { return callback(err); }                                                                

            console.dir(apiResponse);                                                                         
            console.log("3 --------------");                                                                  

            operation.onComplete(function(err, metadata) {                                                    

                if (err) { return callback(err); }                                                            

                console.dir(metadata);                                                                        
                console.log("4 --------------");                                                              

                zone.createVM(BUILDER_MACHINE_NAME, BUILDER_MACHINE_CONFIG, function(err, vm, operation, apiResponse) {

                    if (err) { return callback(err); }                                                        

                    console.dir(apiResponse);                                                                 
                    console.log("5 --------------");                                                          

                    operation.onComplete(function(err, metadata) {                                            

                        if (err) { return callback(err); }                                                    

                        console.dir(metadata);                                                                
                    }); 
                }); 
            }); 
        }); 
    }); 
}); 
knoblauch:gcloud gabriel$ node test_start_instance.js 
{ kind: 'compute#operation',
  id: '10583107913049906294',
  name: 'operation-1447076061239-5241ba697d6d9-c5dede0b-34ef99d6',
  zone: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c',
  operationType: 'insert',
  targetLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2',
  status: 'PENDING',
  user: '262451203973-qh79osjjiu4p1m535ctcu8easjdqsqq3@developer.gserviceaccount.com',
  progress: 0,
  insertTime: '2015-11-09T05:34:21.878-08:00',
  startTime: '2015-11-09T05:34:22.254-08:00',
  selfLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/operations/operation-1447076061239-5241ba697d6d9-c5dede0b-34ef99d6' }
1 --------------
{ kind: 'compute#operation',
  id: '10583107913049906294',
  name: 'operation-1447076061239-5241ba697d6d9-c5dede0b-34ef99d6',
  zone: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c',
  operationType: 'insert',
  targetLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2',
  targetId: '4373660117496197775',
  status: 'DONE',
  user: '262451203973-qh79osjjiu4p1m535ctcu8easjdqsqq3@developer.gserviceaccount.com',
  progress: 100,
  insertTime: '2015-11-09T05:34:21.878-08:00',
  startTime: '2015-11-09T05:34:22.254-08:00',
  endTime: '2015-11-09T05:34:39.789-08:00',
  selfLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/operations/operation-1447076061239-5241ba697d6d9-c5dede0b-34ef99d6' }
2 --------------
{ kind: 'compute#operation',
  id: '6870260316579089297',
  name: 'operation-1447076082997-5241ba7e3d709-61971dad-f5319c1a',
  zone: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c',
  operationType: 'delete',
  targetLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2',
  targetId: '4373660117496197775',
  status: 'PENDING',
  user: '262451203973-qh79osjjiu4p1m535ctcu8easjdqsqq3@developer.gserviceaccount.com',
  progress: 0,
  insertTime: '2015-11-09T05:34:43.109-08:00',
  startTime: '2015-11-09T05:34:43.445-08:00',
  selfLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/operations/operation-1447076082997-5241ba7e3d709-61971dad-f5319c1a' }
3 --------------
{ [Error: Operation did not complete.] code: 'OPERATION_INCOMPLETE' }

Activity

  1. gabipetrovay commented on Nov 9, 2015

    @gabipetrovay
    gabipetrovay
    on Nov 9, 2015
    Author
    More actions

    Also when trying to create and start a VM image with a name that once existed before (and the VM was deleted)

    var BUILDER_MACHINE_NAME = "image2";
    var BUILDER_MACHINE_CONFIG = {                                                                                
        os: "ubuntu",                                                                                             
        machineType: "g1-small"                                                                                   
    };                                                                                                            
    
    var gce = gcloud.compute();                                                                                   
    var zone = gce.zone(zone);                                                                                    
    
    zone.createVM(BUILDER_MACHINE_NAME, BUILDER_MACHINE_CONFIG, function(err, vm, operation, apiResponse) {       
    
        if (err) { return callback(err); }                                                                        
    
        console.dir(apiResponse);                                                                                 
        console.log("1 --------------");                                                                          
    
        operation.onComplete(function(err, metadata) {                                                            
    
           if (err) { return callback(err); }                                                                    
    
           console.dir(metadata);                                                                                
           console.log("2 --------------");                                                                      
    
            vm.start(function(err, operation, apiResponse) {
    
                if (err) { return callback(err); }
    
                console.dir(operation);
                console.dir(apiResponse);
            });
        });
    });

    you get the following error:

    knoblauch:gcloud gabriel$ node test_start_instance.js 
    { kind: 'compute#operation',
      id: '4041052580099853877',
      name: 'operation-1447077664004-5241c062017a1-2f49f43d-3d674879',
      zone: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c',
      operationType: 'insert',
      targetLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2',
      status: 'PENDING',
      user: '262451203973-qh79osjjiu4p1m535ctcu8easjdqsqq3@developer.gserviceaccount.com',
      progress: 0,
      insertTime: '2015-11-09T06:01:04.649-08:00',
      startTime: '2015-11-09T06:01:05.029-08:00',
      selfLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/operations/operation-1447077664004-5241c062017a1-2f49f43d-3d674879' }
    1 --------------
    { kind: 'compute#operation',
      id: '4041052580099853877',
      name: 'operation-1447077664004-5241c062017a1-2f49f43d-3d674879',
      zone: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c',
      operationType: 'insert',
      targetLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2',
      status: 'DONE',
      user: '262451203973-qh79osjjiu4p1m535ctcu8easjdqsqq3@developer.gserviceaccount.com',
      progress: 100,
      insertTime: '2015-11-09T06:01:04.649-08:00',
      startTime: '2015-11-09T06:01:05.029-08:00',
      endTime: '2015-11-09T06:01:06.798-08:00',
      error: { errors: [ [Object] ] },
      httpErrorStatusCode: 409,
      httpErrorMessage: 'CONFLICT',
      selfLink: 'https://www.googleapis.com/compute/v1/projects/sigma-cairn-99810/zones/europe-west1-c/operations/operation-1447077664004-5241c062017a1-2f49f43d-3d674879' }
    2 --------------
    { [ApiError: The resource 'projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2' was not found]
      errors: 
       [ { domain: 'global',
           reason: 'notFound',
           message: 'The resource \'projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2\' was not found' } ],
      code: 404,
      message: 'The resource \'projects/sigma-cairn-99810/zones/europe-west1-c/instances/image2\' was not found',
      response: undefined }
    

    I can see that there is an error in the operation before the call to vm.start, but why doesn't the operation return the error in the err argument (between markers 1 --- and 2 ---)

  2. stephenplusplus commented on Nov 9, 2015

    @stephenplusplus
    stephenplusplus
    on Nov 9, 2015
    Contributor
    More actions

    Thanks for reporting this!

    Related issue: #921

    operation.onComplete was designed to be a super simple wrapper around operation.getMetadata. Behind the scenes, onComplete just pings the API for an update on how the operation is progressing via setTimeout & getMetadata. When the operation is complete, the response is sent as the second argument to the callback.

    Because onComplete consistently polls the API, if something were to happen where the operation never completed, or simply took more than a trivial amount of time, the defaults are "check up to 10 times every 3 seconds". So if the operation didn't complete within 30 seconds, you'll get the OPERATION_INCOMPLETE error. Which, as discussed in #921, is quite confusing.

    We're going to expand on how the Operation object works, turning it into an event emitter, where an error returned from the API response will trigger an .on('error') handler. That's coming soon, but for now:

    operation.onComplete({ maxAttempts: 999999 }, function(err, metadata) {
      var error = err || metadata && metadata.error;
      if (error) {
        // problems!
      }
    });

    Because #921 is going to fix the confusion, I'll close this issue. If you have any thoughts on how we should make that work, please share them over there.

    Thanks!

  3. stephenplusplus
    closed this as completedon Nov 9, 2015
  4. stephenplusplus
    added
    type: questionRequest for information or clarification. Not an issue.
    api: computeIssues related to the Compute Engine API.
    on Nov 9, 2015
  5. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  6. sofisl
    added 4 commits that reference this issue on Jan 17, 2023

    fix(deps): google-gax v2.17.1 (#926)

    23bfad8

    chore: release 2.3.6 (#927)

    4ba6ed8

    chore(deps): update dependency uuid to v9 (#926)

    aeba729

    chore(deps): update dependency uuid to v9 (#926)

    bf5fc49
  7. miguelvelezsa
    added a commit that references this issue on Jul 23, 2025

    docs: updated code of conduct (includes update to actions) (#926)

    0fdb0f3
  8. sofisl
    added 8 commits that reference this issue on Jan 27, 2026

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    263f392

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    f46a2e0

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    bd5db84

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    9bdf99c

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    d3110fd

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    4c04f99

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    1710707

    chore(deps): update actions/checkout digest to 0ad4b8f (#926)

    f887ce4
  9. GautamSharda
    added a commit that references this issue on Mar 11, 2026

    docs: update site link for UpdateTopicRequest (#926)

    9abd20d
  10. sofisl
    added a commit that references this issue on Mar 13, 2026

    chore: fix multiple failing tests on main (#920)

    8eba390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

api: computeIssues related to the Compute Engine API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.