Skip to content

Restart API not working #450

Open
Open

Description

@sumitflickstree

Bug: Runpod restart API not working

Endpoint: POST https://rest.runpod.io/v1/pods/{pod-id}/restart

Description:
When calling the restart API, it returns a success response (200 OK) but the pod does not actually restart. There is no change in pod state or behavior.

Steps to Reproduce:

Send a POST request to the above endpoint with a valid pod ID and API key

Observe the response

Check pod status — it remains unchanged

Expected Result:
The pod should stop and start again, similar to a manual restart from the dashboard.

Actual Result:
API returns success, but pod continues running without restarting.

Notes:

Tried with multiple pods and tools (curl, Postman)

Manual restart from dashboard works fine

Activity

  1. kowshik24 commented on Jul 30, 2025

    @kowshik24

    I think there's not restart option right now. If you needed restart the pod you can first call the runpod.stop_pod(pod_id) then wait for the pod to stop e.g time.sleep(wait_time) then use resume_result = runpod.resume_pod(pod_id, gpu_count)

  2. kowshik24 commented on Jul 30, 2025

    @kowshik24

    @deanq if needed the /restart api can I work on that?

  3. sumitflickstree commented on Jul 31, 2025

    @sumitflickstree
    Author

    Stopping the pod resets the data, which I don't want. Restarting it doesn't delete the data.

  4. added a commit that references this issue on Aug 4, 2025
    f6756b4
  5. justinwlin commented on Aug 4, 2025

    @justinwlin
    Contributor

    I've filed a bug with the team, thanks for this report. It does seem that there are deeper issues after my investigation and I've passed it along in a ticket.

  6. justinwlin commented on Aug 4, 2025

    @justinwlin
    Contributor

    As an unofficial work around, what I've done is I wrote a script you can run in your chrome console:

    When you click the restart button will show you an api request you can make that the restart button is making. I've checked it works.

    Not officially supported, but depending on your use case this could be a temporary hold over.

    // Network Request Interceptor for Pod Restart
    (() => {
      console.log('🚀 Pod Restart Network Interceptor Active');
      
      // Store original fetch
      const originalFetch = window.fetch;
      
      // Override fetch to log requests
      window.fetch = async function(...args) {
        const [url, options = {}] = args;
        
        // Check if this is a restart request
        if (url.includes('/restart')) {
          console.group('🔄 POD RESTART REQUEST DETECTED');
          console.log('📍 URL:', url);
          console.log('🔧 Method:', options.method || 'GET');
          console.log('📋 Headers:', options.headers || 'No headers');
          console.log('📦 Body:', options.body || 'No body');
          
          // Log all headers if they exist
          if (options.headers) {
            console.log('📑 Header Details:');
            if (options.headers instanceof Headers) {
              for (let [key, value] of options.headers.entries()) {
                console.log(`  ${key}: ${value}`);
              }
            } else {
              console.log(options.headers);
            }
          }
          
          // Create curl command
          let curlCommand = `curl --request ${options.method || 'GET'} \\\n  --url "${url}"`;
          
          if (options.headers) {
            if (options.headers instanceof Headers) {
              for (let [key, value] of options.headers.entries()) {
                curlCommand += ` \\\n  --header "${key}: ${value}"`;
              }
            } else {
              for (let [key, value] of Object.entries(options.headers)) {
                curlCommand += ` \\\n  --header "${key}: ${value}"`;
              }
            }
          }
          
          if (options.body) {
            curlCommand += ` \\\n  --data '${options.body}'`;
          }
          
          console.log('📝 CURL Command to reproduce:');
          console.log(curlCommand);
          console.groupEnd();
        }
        
        // Call original fetch
        try {
          const response = await originalFetch.apply(this, args);
          
          // Log response for restart requests
          if (url.includes('/restart')) {
            console.group('✅ POD RESTART RESPONSE');
            console.log('📊 Status:', response.status, response.statusText);
            console.log('📑 Response Headers:');
            for (let [key, value] of response.headers.entries()) {
              console.log(`  ${key}: ${value}`);
            }
            
            // Clone response to read body without consuming it
            const clonedResponse = response.clone();
            try {
              const responseData = await clonedResponse.text();
              console.log('📄 Response Body:', responseData);
            } catch (e) {
              console.log('📄 Could not read response body');
            }
            console.groupEnd();
          }
          
          return response;
        } catch (error) {
          if (url.includes('/restart')) {
            console.error('❌ POD RESTART ERROR:', error);
          }
          throw error;
        }
      };
      
      // Also intercept XMLHttpRequest if needed
      const originalXHR = window.XMLHttpRequest;
      window.XMLHttpRequest = function() {
        const xhr = new originalXHR();
        const originalOpen = xhr.open;
        const originalSend = xhr.send;
        
        xhr.open = function(method, url, ...args) {
          xhr._url = url;
          xhr._method = method;
          return originalOpen.apply(this, [method, url, ...args]);
        };
        
        xhr.send = function(body) {
          if (xhr._url && xhr._url.includes('/restart')) {
            console.group('🔄 POD RESTART XHR REQUEST');
            console.log('📍 URL:', xhr._url);
            console.log('🔧 Method:', xhr._method);
            console.log('📦 Body:', body);
            
            // Log request headers
            console.log('📑 Request Headers:', xhr.getAllResponseHeaders());
            console.groupEnd();
          }
          
          return originalSend.apply(this, arguments);
        };
        
        return xhr;
      };
      
      console.log('✅ Interceptor ready! Click the restart button to see the network details.');
    })();
    
  7. sumitflickstree commented on Aug 7, 2025

    @sumitflickstree
    Author

    I've filed a bug with the team, thanks for this report. It does seem that there are deeper issues after my investigation and I've passed it along in a ticket.

    HI @justinwlin any updates on this?

  8. talhadar90 commented on Oct 13, 2025

    @talhadar90

    Hello!

    Any update on this? It still does not work

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions